Rounding issue in discount recalculation during order edit

Hi,

I am doing an order edit to turn a variant into several variants in the order. The sum and the line item price will remain the same. There is a 20% discount code applied to all line_items in the order. The screenshot will show what I am doing now:

bab.png

Prev:

1 item + shipping = 39.96 + 10 = $49.96

discount on line items = 39.96 * 0.2 = 7.992 = $7.99 (rounded down to 2 d.p)

Recording the doc, % discount on the whole order is recalcuated.

After my edit (the below discount calculation is according to my understand):

4 items + shopping = 39.96 + 10 = $49.96

discount on line items = 9.99 * 2 * 0.2 + 9.99 * 0.2 + 9.99  * 0.2 = 3.996 (rounded down to 2 d.p) + 1.998 (rounded down to 2 d.p) + 1.998 (rounded down to 2 d.p)

= 3.99 +1.99 + 1.99 = $7.97

So the new discount is $0.02 less than the original. The customer owes the order $0.02

I tried to check the discount application:

{"discount_application": {"target_type": "line_item", "type": "discount_code", "value": "20.0", "value_type": "percentage", "allocation_method": "across", "target_selection": "all", "code": "BOWLBUDDY"}}

The target selection is all. So my question is: Why Shopify doesn't add all line items price and then apply the discount in the recalculation? Is it more reasonable this way?

Finally, how can I retain the discount remains as $7.99 so the order is not partially paid? I will apply the extra $0.02 discount on my own?

Does anyone have a similar experience?

SPO - SEO App to research keywords & edit social link preview
BYOB - Build Your Own Bundles
0 Likes

Did anyone try to remove the discount variation created by % discount?

I think this is how 'across' discount allocation works according to this thread. However, I can't find a solution to this problem. And the order edit doesn't provide a way to add a fixed amount discount to an order. Otherwise, I can compensate for the discount variation on my own. 

SPO - SEO App to research keywords & edit social link preview
BYOB - Build Your Own Bundles
0 Likes