Splits an order item into two lines in the same order. The response contains objects for the original_orderitem as well as the split_orderitem. Store the split item’s line_id if you track order lines in an external system.
Before you begin#
- The API token needs
OrderItem_Split, either assigned directly under Functions or through a group. See Create an API token. - Requests must be signed if the token requires it. See Make a signed request with HMAC.
- You need the order ID and the item’s
line_id.OrderList_Load_Queryreturns both.
Example requests#
Split an item#
Splits line 6 of order 1000. The new line gets a quantity of 4.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "OrderItem_Split",
"Line_ID": 6,
"Order_ID": 1000,
"Quantity": 4
}
Request parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
Order_ID |
Integer | Order ID | |
Line_ID |
Integer | Yes | Line ID |
Quantity |
Integer | Yes | Quantity to move to the new line. Must be less than the line item’s quantity. |
Example response#
{
"success": 1,
"data": {
"original_orderitem": {
"order_id": 1000,
"line_id": 6,
"status": 0,
"subscrp_id": 0,
"subterm_id": 0,
"shpmnt_id": 0,
"rma_id": 0,
"product_id": 1,
"dt_instock": 0,
"code": "shirt",
"name": "Shirt",
"sku": "",
"retail": 25.0,
"base_price": 25.0,
"price": 20.0,
"weight": 0.0,
"taxable": true,
"tax": 0.0,
"formatted_tax": "$0.00",
"upsold": false,
"quantity": 2,
"discounts": [
{
"order_id": 1000,
"line_id": 6,
"pgrp_id": 1,
"display": true,
"descrip": "20OFF",
"discount": 5.0
}
],
"options": [
{
"id": 7,
"order_id": 1000,
"line_id": 6,
"attr_id": 1,
"attr_code": "size",
"attmpat_id": 0,
"option_id": 1,
"opt_code": "small",
"retail": 0.0,
"base_price": 0.0,
"price": 0.0,
"weight": 0.0,
"data": "",
"data_long": "",
"attr_prompt": "Select Size",
"opt_prompt": "Small",
"attribute": "size",
"value": "small"
}
],
"total": 40.0
},
"split_orderitem": {
"order_id": 1000,
"line_id": 10,
"status": 0,
"subscrp_id": 0,
"subterm_id": 0,
"shpmnt_id": 0,
"rma_id": 0,
"product_id": 1,
"dt_instock": 0,
"code": "shirt",
"name": "Shirt",
"sku": "",
"retail": 25.0,
"base_price": 25.0,
"price": 20.0,
"weight": 0.0,
"taxable": true,
"tax": 0.0,
"formatted_tax": "$0.00",
"upsold": false,
"quantity": 4,
"discounts": [
{
"order_id": 1000,
"line_id": 10,
"pgrp_id": 1,
"display": true,
"descrip": "20OFF",
"discount": 5.0
}
],
"options": [
{
"id": 9,
"order_id": 1000,
"line_id": 10,
"attr_id": 1,
"attr_code": "size",
"attmpat_id": 0,
"option_id": 1,
"opt_code": "small",
"retail": 0.0,
"base_price": 0.0,
"price": 0.0,
"weight": 0.0,
"data": "",
"data_long": "",
"attr_prompt": "Select Size",
"opt_prompt": "Small",
"attribute": "size",
"value": "small"
}
],
"total": 80.0
}
}
}
Response parameters#
original_orderitem and split_orderitem each hold an order item with these fields:
| Parameter | Type | Description |
|---|---|---|
order_id |
Number | Order ID |
line_id |
Number | Line ID |
status |
Number | 0 = Pending 100 = Picking 200 = Shipped 210 = Gift Certificate: Not Redeemed 211 = Gift Certificate: Redeemed 220 = Digital: Not Downloaded 221 = Digital: Downloaded 300 = Cancelled 400 = Backordered 500 = RMA Issued 600 = Returned |
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 |
tax |
Number | Sales tax for this specific Item |
formatted_tax |
String | Currency formatted sales tax for this specific Item |
upsold |
Boolean | Upsold |
quantity |
Number | Quantity |
total |
Number | Order Item Total |
discounts |
Object | Discounts |
options |
Object | Options |
discounts object#
| Parameter | Type | Description |
|---|---|---|
order_id |
Number | Order ID |
line_id |
Number | Line ID |
pgrp_id |
Number | Price Group Id |
display |
Boolean | Display |
descrip |
String | Description |
discount |
Number | Discount Amount |
options object#
| Parameter | Type | Description |
|---|---|---|
id |
Number | Option ID |
order_id |
Number | Order Id |
line_id |
Number | Line ID |
attr_id |
Number | Attribute ID |
attr_code |
String | Base Attribute Code |
attmpat_id |
Number | Attribute Template ID |
option_id |
Number | Option ID |
opt_code |
String | Option Code |
retail |
Number | Retail Price |
base_price |
Number | Base Price |
price |
Number | Price |
weight |
Number | Weight |
data |
String | Option Data up to 255 characters |
data_long |
String | Option Long Data (Memo) |
attr_prompt |
String | Attribute Prompt |
opt_prompt |
String | Option Prompt |
attribute |
String | Attribute Code |
value |
String | Option Value |
Error responses#
| Error Code | Error Message | Error Description |
|---|---|---|
| MER-JSN-ORD-00025 | Order not found | Order number not found |
| MER-JSN-00023 | One or more parameters are invalid | Missing required line_id parameter |
| MER-DBP-OIT-00007 | Record not found | line_id passed is not valid |
Related functions#
| Function | Use it to |
|---|---|
OrderItem_Update |
Change one of the lines after the split |
OrderItemList_BackOrder |
Put one of the lines on backorder |
OrderItemList_CreateShipment |
Ship one of the lines |
OrderItem_Add |
Add an item to an order |
OrderList_Load_Query |
Find the order and its line IDs |
Try in Postman#
In the Miva: JSON API: Authenticated collection, open Orders > OrderItem_Split. See Set Up Postman.