Same Sellable, Different Price, Discounts

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?

Hi, @callam!
Unfortunately, Veeqo does not support duplicated line items.

To overcome this, you can make the following request to update the order and account for the additional item quantity and tax:

If the discount for the product is let’s say $1, then you can enter the taxless_discount_per_unit as 0.50, which is the base discount, divided by the quantity of the item. Here, we can assume that the line item has a quantity of 2.

"line_items_attributes": [
    {
        "sellable_id": S1,
        "quantity": 2,
        “taxless_discount_per_unit”: 0.5
    }
]

After this update, Veeqo will display the single line item, with a quantity of two, and a discount per unit of 0.50.

Hope this helps,
Thanks,
Kris.

Hi Kirstien, Callam is doing this API work on our behalf. We actually have the same product come in on separate line items with different discount amounts already, i’ve attached a screenshot for reference. An app called One Click Upsell generates this. When a customer adds an item to their cart, they’re offered an extra one at a discount. If they accept that offer the order comes through to Veeqo as shown.

We’re trying to use post purchase offers with the same app, but because it’s post purchase, the offer is added via order edit after the initial order is made, and veeqo doesn’t support order edits hence why Callam is trying to create this webhook.

@Kristien sorry forgot to tag you above

Hi, @greg!
Thanks for reaching out.

Unfortunately, Veeqo does not support plugins on Shopify that modify line items in the way it’s being done here.

The behaviour of such orders in Veeqo is not correct. You’ll see issues with the amount of items that are shipped, and you’ll not be able to make line item items on Veeqo’s UI. Additionally, duplicated line items like in the order you’ve shown above will impact the ability to manage returns.

It is strongly advised that duplicated line items are not forced on orders as it can result in some negative behaviours.


To answer why it’s been possible to create orders with multiple line items:

This has happened because our channels integrations work differently to our API. Our channels integration creates the line item objects forcefully, but with our API, there is logic to prevent this because it causes issues.

Unfortunately, there is no way to replicate this behaviour through the API.

Thanks,
Kris.