Why does the same product get split into two units in the checkout page?
- The splitting happens when the discount amount cannot be equally split per-item. Essentially, we calculate the discounts using the same method that Shopify uses internally, which leads to the following calculation:
Total discount for # items:
Discount per item:
When Shopify applies discounts internally, they have the option to apply that discount to the line item. Apps however need to specify the per-item discount, and since we cannot send [per-item discount] to Shopify, we split the items on two lines and then the first line has # qty [discount per item] = total discount, and the second line has # qty [discount per item] = total discount, so that when summed, the total discount is still correct: first line total discount + second line total discount = Total discount for # items
Total discount for # items:
Discount per item:
When Shopify applies discounts internally, they have the option to apply that discount to the line item. Apps however need to specify the per-item discount, and since we cannot send [per-item discount] to Shopify, we split the items on two lines and then the first line has # qty [discount per item] = total discount, and the second line has # qty [discount per item] = total discount, so that when summed, the total discount is still correct: first line total discount + second line total discount = Total discount for # items
Updated on: 22/02/2024