Hey everyone ![]()
I ran into something odd with the new unified discount function scaffolding in Shopify CLI and wanted to check if others have seen this too.
When creating a discount function using the new type = “function” scaffold, the generated shopify.extension.toml automatically sets:
type = “function”
[[extensions.targeting]]
target = “cart.lines.discounts.generate.run”
Even though my code clearly returns an order-level discount using orderDiscountsAdd, any discount created in Admin shows up in GraphQL as:
“discountClass”: “PRODUCT”
That means the function is being registered as a Product Discount Function, even though it behaves like an Order Discount Function.
This causes odd behavior in the Admin (e.g. “combine with order discounts” not working correctly) and inconsistent data in GraphQL.
Has anyone else seen this with the new scaffolding? Should the CLI perhaps default to cart.orderDiscounts.run when creating order-type discount functions?
– Seth