I would like to update an order.
When a customer places an order, ocasionally that customer later adds an item to this order.
This item is often the same item they initially purchased, with a discount applied.
So for example this order would be created
[
{SKU: AB12, price: 10.00},
{SKU: AB12, price: 5.00, discount: 0.5},
]
So I send this object to the allocations endpoint (POST /orders/{order_id}/allocations):
{
“warehouse_id”: WH1,
“line_items_attributes”: [
{
“sellable_id”: S1,
“quantity”: 2,
“additional_options”: “X UPDATE”
}
]
}
And this object to the order endpoint (PUT /orders/{order_id})
{
“order”: {
“total_tax”: “2.04”,
“total_price”: “12.28”,
“line_items_attributes”: [
{
“sellable_id”: S1,
“taxless_discount_per_unit”: 0.0,
“price_per_unit”: 3.96,
“quantity”: 1,
“tax_rate”: 0.2,
“additional_options”: “X UPDATE”,
},
{
“sellable_id”: S1,
“taxless_discount_per_unit”: 0.59,
“price_per_unit”: 3.96,
“quantity”: 1,
“tax_rate”: 0.2,
“additional_options”: “X UPDATE”,
},
],
“total_discounts”: 0.59,
}
}
However, the order is updated only to reflect the last value in the line_items_attributes list.
How can I add two line items of the same sellable with different prices / discounts?