Shopify Scripts Template -- Discount on Sale Items Only

Hi there,

We are looking to run a promotion on sale items only (i.e., if a customer adds one sale item to their cart and one full priced item to their cart, the discount only applies to sale item). We are a clothing store, so all of our products have two variant dimensions: color and size. The problem is, many of our products have only some colors on sale, and other colors are full priced (but they live within the same product grid). Therefore, we want this discount to apply only to the colors that are on sale.

We also have many products where all colors are on sale, so this issue does not apply to every product.

Is there a Scripts template we can use to achieve this? Any help would be very appreciated!

Hi @lucymaloney ,

By ‘sale’ item you mean there’s a compare at price lower that then original price?

If you go with a script, just have it automatically apply the discount code. What you need is an app to generate a price rule that has all the variant IDs that are applicable to this discount. Since we know it should only be sale items, we would be fetching your products using REST Admin API then once we have all the variant IDs a discount code can be generated. That discount code could then be automatically applied/removed with a script.

So just to recap my solution here is to essentially save you time from having to go through Shopify selecting the variants that are on sale, which there is no indicator of sale items when creating a discount code. The app would essentially be a discount code generator which you could select “all sale items” and it would display a code. The logic behind “all sale items” is basically checking the compare at price then adding that variant ID into the price rule (discount code).

If you would like to hire us for the solution, please reach out to me: hello@achieveapplabs.com or private message me here.

Best regards,

Sam - Owner/Lead Developer

Achieve Applabs