Discount Applications exposes line level discounts on the Order API

Shopify Staff
Shopify Staff
16 0 0

Hi Clement! Just wanted to give you an update. We fixed the issue and the amount allocations should be showing on that order now. Sorry about the inconvenience. 

0 Likes
Shopify Partner
660 0 104

Thanks Felix, I can see this order is fixed.

To clarify, was it fixed across all orders or just that particular one?

I'm hoping the fix is for all orders but if it's just this one, we'll have to make sure our code doesn't blow up and can handle that situation should it arise with another order. 

0 Likes
Shopify Staff
Shopify Staff
16 0 0

It was a fix for all orders impacted by this defect, not just this single one. Note that the fix might take some time to take effect on all shards because of caching.

0 Likes
Shopify Partner
660 0 104

Sweet! Thanks again for the quick turn around.

We are deploying today.

0 Likes
Shopify Partner
660 0 104

Hi Felix,

We ended up deploying today only, but we have already come across another order for which the data doesn't add up.

Order.total_discounts is 0 even though there is a discount application of 3,400.

The order id is 186524172301. Can you please take a look?

0 Likes
Shopify Partner
660 0 104

And now another order that doesn't add up came through. This time it appears to be a rounding error.

Order.total_discounts is 135.99 but there are two discounts application of 68.00.

(2 x 68 = 136) != 135.99

This is not great and I'd appreciate if you could look into this one as well.

Order id is 527794110523.

We've only deployed this change for a few minutes ago so I'm assuming more of these might come through.

I will not report them anymore if they look like similar to those two cases...

0 Likes
Shopify Staff
Shopify Staff
16 0 0

Sure I’ll take a look at both. Thanks for reporting those!

0 Likes
Shopify Staff
Shopify Staff
16 0 0

The first order was created with bad data using Orders API. total_discounts was sent alongside discount_codes.amount with different values. At the time, we did not do any validation / recalculation if the two values were not synced. In other words, the client could send anything and it would just be persisted as is. We changed that on April 9th, discount_codes.amount now has precendence and total_discounts is calculated from ther former so this won't happen with orders created after that date.

As for the second issue, we are working on a fix for all orders. I will keep you posted.

0 Likes
Shopify Staff
Shopify Staff
16 0 0

We found a fix for the penny rounding issue and it should be deployed tomorrow.

0 Likes
Shopify Partner
660 0 104

Thanks Felix for another quick turn around.

We've noticed a few more discrepancies in our logs and almost of them are related to the rounding issue so we're glad a fix is coming.

Any reason the first issue will not get a fix as well to set total_discounts  = discount_codes.amount?

0 Likes