Skip to content

OrderItem_Add#


Description#

This function allows you to add an item (product) to an order.

Request Body Parameters#

Parameter
Type Description
order_id Number Order Id to add item to
code String Product Code to Add (this does not need to exist as a product in Miva’s Database)
name String Product Name
sku String Product SKU
quantity Number Product Quantity
weight Number Weight
Taxable Boolean Taxable
attributes Object Attributes

attributes Object#

Parameter
Type Description
attr_code Number Attribute Code
opt_code_or_data String Option Code/Data
opt_code String Option Code
price Number Price
weight Number Weight

Response Parameters#

Parameter
Type Description
total Number Order Total after new item has been added
formatted_total String Currently Formatted Order Total
orderitem Object Record for newly created order item

orderitem object#

Parameter
Type Description
order_id Number Order ID
line_id Number Line ID
status Number Item Status
subscrp_id Number Subscription ID
subterm_id Number Subscription Term Id
rma_id Number Return Merchandise Authorization Id
dt_instock Number Date/Time Instock (Unix timestamp)
code String Code
name String Name
sku String Sku Number
retail Number Retail Price
base_price Number Base Price
price Number Price
weight Number Weight
taxable Boolean Taxable
upsold Boolean Upsold
quantity Number Quantity
options Array Options

Example Request#

{
    "Store_Code": "{{Store_Code}}",
    "Miva_Request_Timestamp": "{{$timestamp}}",
    "Function": "OrderItem_Add",
    "Order_ID": 1000,
    "Code": "shirt",
    "Name": "Custom T-Shrt",
    "SKU": "shirt-red-small",
    "Quantity": 3,
    "Price": 10.58,
    "Weight": 1,
    "Taxable": true,
    "Attributes": [
        {
            "attr_code": "size",
            "opt_code_or_data": "small",
            "price": 0,
            "weight": 0
        },
        {
            "attr_code": "color",
            "opt_code_or_data": "red",
            "price": 0,
            "weight": 0
        }
    ]
}

Example Response#

{
    "success": 1,
    "data": {
        "total": 31.74,
        "formatted_total": "$31.74",
        "orderitem": {
            "order_id": 1000,
            "line_id": 161,
            "status": 0,
            "subscrp_id": 0,
            "subterm_id": 0,
            "rma_id": 0,
            "dt_instock": 0,
            "code": "shirt",
            "name": "Custom T-Shrt",
            "sku": "shirt-red-small",
            "retail": 0.0,
            "base_price": 10.58,
            "price": 10.58,
            "weight": 1.0,
            "taxable": true,
            "upsold": false,
            "quantity": 3,
            "options": [
                {
                    "id": 85,
                    "order_id": 1000,
                    "line_id": 161,
                    "attr_id": 0,
                    "attr_code": "color",
                    "attmpat_id": 0,
                    "option_id": 0,
                    "opt_code": "",
                    "retail": 0.0,
                    "base_price": 0.0,
                    "price": 0.0,
                    "weight": 0.0,
                    "data": "red",
                    "data_long": "",
                    "attr_prompt": "",
                    "opt_prompt": "",
                    "attribute": "color",
                    "value": "red"
                },
                {
                    "id": 84,
                    "order_id": 1000,
                    "line_id": 161,
                    "attr_id": 0,
                    "attr_code": "size",
                    "attmpat_id": 0,
                    "option_id": 0,
                    "opt_code": "",
                    "retail": 0.0,
                    "base_price": 0.0,
                    "price": 0.0,
                    "weight": 0.0,
                    "data": "small",
                    "data_long": "",
                    "attr_prompt": "",
                    "opt_prompt": "",
                    "attribute": "size",
                    "value": "small"
                }
            ],
            "total": 31.74
        }
    }
}

Error Responses#

Error Code Error Message Error Description
MER-JSN-ORD-00025 Order not found Order number not found.