So with the new functions,
to summarize whenever the automatic discount is applicable, it runs the function. This works great, what doesn’t work great is that the when you use the discountAutomaticAppCreate mutation, it does not have the ability to separate the application between one time purchase products and subscription products. This is a major issue going forward if we want to use functions for bundling logic
You can see below how the discountAutomaticBasicCreate has the ability to add “appliesOnOneTimePurchase” and “appliesOnSubscription” variables, why are those not available on the discountAutomaticAppCreate?
The problem is the discount target application.
It accepts two values. VariantID and quantity.
So even if you filter the target array by the sellingplanallocation, it doesn’t matter because the subscription product and one time purchase both share the same variant ID in the cart
So regardless of how you filter the targets array, when the discount is applied. It applies it based on the variant ID regardless if selling plan or not, so unless the discount application strategy accepts another parameter outside of variant ID this seems a like a big oversight
https://shopify.dev/docs/api/functions/reference/product-discounts/graphql/common-objects/productvarianttarget