I followed the tutorial on building a Shopify function for discounts. The tutorial shows you how to build an automatic 10% discount based on volume. I was able to successful complete the tutorial.
However, I want to create a function that gives free shipping for the first month of signing up for a subscription product. And I cannot figure out how to alter the tutorial to do so.
I’ve gotten as far as to understand that the index.js filters by quantity (.filter(line => line.quantity >= 2 […]) for the volume example (line 29 of the file in the tutorial) and that the 10% discount is declared below that (starting at line 55, value: {percentage: {value: “10.0”}}) I have tried to detect the SellingPlanId instead of the volume, but I have been unable to get it to work.
If someone has an example of how to apply free shipping and/or how to detect if the cart item is a subscription item, it would be greatly appreciated.