Shopify Discount Functions: Duplicate line items in checkout

Topic summary

  • Issue: A product discount function that applies discounts to a subset of a variant splits a cart line correctly, but at checkout an extra non-discounted line item appears. The duplicate has the discounted quantity, totals remain correct, and only one automatic app discount is active. The function outputs a single discount with multiple targets (by variant ID and quantity).

  • Behavior detail: The duplication occurs when the discounted line appears after the non-discounted line for the same variant in the cart. Checkout seems to apply the discount to the first occurrence of the variant and split it again, leading to an additional non-discounted line. There’s no clear way to force the discounted line to appear first via functions.

  • Related reports: Another user sees similar anomalies with standard automatic discounts, including 0-quantity, 0-price line items.

  • Status/outcome: The issue was raised on the Shopify Functions board; Shopify staff acknowledged it as a known problem and stated they are working on a fix. No confirmed workaround was provided; the discussion remains open pending Shopify’s resolution.

Summarized with AI on January 11. AI used: gpt-5.

That’s indeed weird. I noticed this might have been the wrong board for asking this question, so I did it again in the Shopify Functions board: https://community.shopify.com/topic/2327673 A Shopify staff member replied and finally told me Shopify is aware of a problem there and is working on a fix.