Errors while getting line_item discount information

Shopify Partner
2 0 0

I've noticed that discount amount is always 0 while requesting line_items. I’ve tested on order printer, through the order object in the api and also generating a refund of the item to test if the amount appears in the line_item of the refund. In all the cases it will appear 0 instead of the discount amount applied.

This is very important as there’s no way to output the paid price for each product when there’s been a discount for that product (percent, fixed price…). In the line_item, the price field shows the real price, so if we don’t get the discount we can’t calculate the final price. The taxes instead are being updated by the discount.

Here’s an example:

  • Product price: 20.95€ (21% taxes included)
  • Discount applied: 10% (2.10€)
     
  • Then final product price is: 18.85€, 15.58€(Tax excluded)
  • Final product taxes are: 3.27€

What I get from the api or order printer in the line item:

  • line_item.price: 20.95€ —————> Ok
  • line_item.total_discount: 0.00€ —————> Wrong
  • line_item.taxes: {price : 3.27€, rate : 0.21} —————> Ok

It has no sense to update taxes while not giving a way to obtain the final price after a discount.

Can you check this? Without a solution, it’s imposible to show a real detail of the order.

Thanks,
Aritz Fdez

0 Likes
Shopify Staff (Retired)
Shopify Staff (Retired)
409 0 60

Hi Aritz,

Britton here with the Shopify support team.

If you look in our liquid documentation the total_discount object does not exist inside of the line_item object. This is because line items do not get discounts for orders done over an online store, instead discounts apply to an entire order's subtotal amount. 

That means you need to grab the total_discount off of the actual order itself, something like this might work:

{% for discount in order.discounts %}
  {{ discount.total_amount | money }}
{% endfor %}

 Keep in mind though that our liquid documentation also explicitly states that the discount object is only available in the notifications or Order Printer areas. As you are pulling that information from the API you might be OK, but it's also possible that the object won't be defined in that scope.

I hope this helps!

-Britton

Britton Shopify Guru
0 Likes
Shopify Expert
3991 13 316

I love how Shopify gleefully points out a huge weakness in the money handling aspect of orders and papers it over as if it is a feature that should just be adopted as normal.

It sure would be nice if the tone was more one of sincere apologies for driving accountants and others interested in the financial aspect of transactions crazy with this obvious flaw. Combined with a sincere effort to fix this flaw, Shopify would be one step closer to presenting a level of financial reporting that is on par with the best systems out there.  

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
2 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
298 0 148

Hey Bill,

I want to get to the root of the issue you're having, because it sounds like we're not documenting something or making it clear enough to folks reading through our API guide.

Is this something you've looked for in the past to no avail? If you feel like explaining here, please do.

I'll see if I can do anything to help you out.

- Alex

0 Likes
Excursionist
41 0 8

Hello,

this issue is still open - It really is a massive issue which is driving merchants activly away since accounting is almost impossilbe with wrong line item discounts.

9 months in, is there any outcome?

 

0 Likes
Shopify Expert
3991 13 316

Nine months? This has been broken for years and years!! I like your optimism!

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Shopify Partner
5 0 1

It seems Im having a related problem. When applying a discount on a mixed tax cart - I can not show the amounts for the different tax rates to the customer. In germany we have to do this by law... so this really bugs me.

0 Likes
Shopify Expert
3991 13 316

Hi @Alex from Shopify,

There is nothing you can do. Discounts have never reported correctly in the API from the line item level, hence the years and years of frustration. 

No worries though! Shopify is apparently on the cusp of releasing an all-new, all fixed, super-deluxe, correct Discount engine incorporated into orders, so that API calls get accurate data at the item level! Accountants all wet their pants on the count of three!!

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
New Member
2 0 0

@HunkyBill Were you being sarcastic or is this issue actually going to be fixed, and if so when? Can we get a link to a press release or something to see the details?

0 Likes
Shopify Expert
3991 13 316

@Aleksey. Sarcasm? What? Me? Never... you have to believe they are on it. There will be no press release. There will be no fanfare. One day, we will awaken to correct numbers. That is all. It has been years, what difference does another day make. Patience grasshopper.. patience. 

You know there is never ever a "when" issued by corporations, and especially when it comes to bugs or software. You see any companies releasing that kind of info.. how about none! It is too difficult to prophesize.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes