I’ve built a custom Shopify Function to apply product-specific discounts using a function extension. It works correctly at the line-item level.
However, when I create a discount using my app, the resulting discount in the Shopify Admin appears with “Types: Product, Order & Shipping” instead of just “Product.” This is problematic because:
- Even though my function only targets product-level discounts,
- Shopify’s discount engine treats it as being eligible to override order discounts, since only one discount class is applied per checkout (e.g. product or order or shipping).
- This results in my product discount canceling out an actual order-level discount, even though they should be stackable under Shopify’s rules. If I make order discounts stackable then people can apply 3 or 4 and get the products for free.
What’s confusing is that I don’t get the option to restrict the discount type during discount creation via my app. I also can’t find any documentation or UI to specify the applicable discount class as only Product.
What I’ve tried:
- My function uses productDiscountsAdd with selectionStrategy: ProductDiscountSelectionStrategy.Maximum
- The logic itself only operates on cart.lines
- I added a UI extension, but the Admin doesn’t prompt for discount class or type selection during the creation flow.
My question:
How can I ensure that a discount created through my app using a function extension is classified strictly as a Productdiscount, so it doesn’t interfere with Order or Shipping discounts?
Thanks in advance for any insights!