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!
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024