Discounts do not appear in checkout webhook (Line Item level)

PatrickWatzeels
Shopify Expert
11 0 9

Hi all,

We have noticed that the Checkout Webhooks do not contain information about discounts on line item level. Although the tax line is updated in the line_item when you apply a discount. So there is something applied, but the line_item total is not updated. Also the discount cannot be found in the "allocated_discount" property (where I would expect it).

 

An example on this. I have 2 products and the second product has a 20% discount code (see below)

Screenshot 2021-02-08 at 17.05.33.png

 

When I receive the "checkout/update" webhook from Shopify. I do see that the total amount was updated, I have a 200.00 euro discount on order level.

 

    ...
    "presentment_currency": "EUR",
    "total_discounts": "200.00",
    "total_line_items_price": "1089.00",
    "total_price": "889.00",
    "total_tax": "154.29",
    "subtotal_price": "889.00",
    ...

 

 

When I look into the line item where I applied the discount. There is no allocation mentioned on any discount.

Below a representation of the line_item that I'm mentioning. The product price is still 1.000 euro. 
And the strange part is, the tax value is updated according to the discount.. Since 138.84 is the value of the tax with the discount being applied. A quick math: 21% tax. 800 euro is 121%. 800/121 = 6.61157... .6.61157... times 21 = 138.84. That is exact the amount in the webhook.

 

{
    "applied_discounts": [],
    "key": "ffc4a8c4aa6a7ec4d75226ec8e55fcdf",
    "destination_location_id": null,
    "fulfillment_service": "manual",
    "gift_card": false,
    "grams": 0,
    "origin_location_id": 1933535608876,
    "presentment_title": "Gold neckless",
    "presentment_variant_title": "",
    "product_id": 5408600391724,
    "properties": [],
    "quantity": 1,
    "requires_shipping": true,
    "sku": "GOLD-123",
    "tax_lines": [
        {
            "position": 1,
            "price": "138.84",
            "rate": 0.21,
            "title": "NL VAT",
            "source": "ActiveTax",
            "compare_at": 0.21,
            "zone": null,
            "channel_liable": false,
            "identifier": null
        }
    ],
    "taxable": true,
    "title": "Gold neckless",
    "variant_id": 34685847339052,
    "variant_title": "",
    "variant_price": "1000.00",
    "vendor": "Mollie payments store",
    "user_id": null,
    "unit_price_measurement": {
        "measured_type": null,
        "quantity_value": null,
        "quantity_unit": null,
        "reference_value": null,
        "reference_unit": null
    },
    "rank": null,
    "compare_at_price": null,
    "line_price": "1000.00",
    "price": "1000.00"
}

 

 

To me this is a bug in the payload of the checkout webhook, you should be able to allocate the applied discount on line_item level. Especially because the tax_line is updated. So it is applied for 50%.

I hope that someone at Shopify can take a look into this so that it can be resolved soon.


Thanks in advance!

Solutions Engineer / Sr. Developer at CODE - a Shopify Plus agency | Delft | The Netherlands