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!
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024