Personalized checkout and custom promotions with Shopify Scripts
Hello,
We are currently migrating from Shopify scripts to one-page checkout and are developing an extension that applies the product discount to certain customers based on the tag. What we want to do is,
if a product is on sale, i.e. variant has a compare-at-price value, then apply the discount to the compare-at price and if the compare-at price is null then apply the discount to the regular price.
Wondering if this is possible with product discount functions or any other functions. If so, how can we achieve this?
Greatly appreciate your time for reading and your input.
Thanks !!
I had the same problem as you. I'm currently developing the transition from script to function. We cannot access the compare at input in the product discount api. My client and I developed a solution by moving the compare at input to the metafield. We can also access the Metafield area through the product discount API. If there are not many products and variants, I recommend you move the compare at input to the metafield. If it is not possible to move manually, it makes more sense to move it by programming.
That is one way to do it if you have fewer products, unfortunately, we have lots of different products with variants and the sale is done by the marketing team through the Launchpad app, which does this compare-at-price thing when the sale is live hence I needed somehow the access to compare at price, however, this does not look possible with product discount API at this moment.
I thought this would be a simple use case but oh well, I spent a whole lot of time thinking the solutions from different angles. Anyways, thanks for replying and for the great suggestion.
Hi EssDeeJay,
Did you ever find a solution for this using functions? We have the same setup with lots of variants and using launchpad. Thx!
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025