Personalized checkout and custom promotions with Shopify Scripts
I am using script editor which is made by Shopify.
I want to disable discount codes for products that have "no_discount" tag.
But I have some problem.
For example, if there are 4 products in the cart.
And only one product has "no_discount" tag.
In this case, let's imagine I use a discount code that discount by 10%.
I want to prevent discount for only the product which has "no_discount" tag.
And discount for other three products by 10%.
Is it possible?
If you're using discount codes, you don't even need the script editor. Create a collection with all the items that are eligible for the discount, and have the discount code only apply to that collection. (Note that Shopify cannot EXCLUDE items from a smart collection based on tags, so you would need to tag eligible products rather than ineligible products.)
If you're apply the discount via line item script, I assume you're looping through each item in the cart. Before applying the discount to the line item, add an "unless" statement similar to this:
unless line_item.variant.product.tags.include?('no_discount')
Don't forget to end your unless loop!
User | RANK |
---|---|
3 | |
2 | |
2 | |
2 | |
2 |
Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023