Tiered Discount by Product Tag

Highlighted
New Member
1 0 0

Hello, looking for code for a tiered discount script based on product tag.

Example:

If product tag = "A" discount the line item by 25%

If product tag = "E" discount the line item by 20%

Also, is there a way to prevent additional discount codes entered at checkout, to avoid an extra discount on the above?

Thanks!

0 Likes
Highlighted
Explorer
66 0 28

Hey Mitch - you might be interested in checking out our (paid) application Playwright, that generates Shopify Scripts on demand (including tiered pricing based on tags) and can support discount code rejection: https://playwright.discolabs.com/login.

Author of http://gavinballard.com/mastering-shopify-themes/ and http://bootstrapforshopify.com.
0 Likes
Highlighted
Shopify Partner
194 2 11

Hi Mitch, 

I think that you don't need to find the product tag to create the discount campaign on your website. Because it is too complicated to remember for you and your customers. 
You only need to use Discount Master, this app will help you create the discount campaign without the product tag. You only choose products or collections, all will be worked automatically. It's nice to introduce to you. 
Thanks! 

0 Likes
Highlighted
Excursionist
32 0 7

Hey, here is some code you can work off of in the script editor. This is for one tag but can be easily changed to work for two.

@percent = Decimal.new(25) / 100.0
Input.cart.line_items.each do |line_item|
product = line_item.variant.product
next if product.gift_card?
next unless product.tags.include?('Coconut')
line_discount = line_item.line_price * @percent
line_item.change_line_price(line_item.line_price - line_discount, message: "25% Off")
end

Output.cart = Input.cart

 

0 Likes
Highlighted
Shopify Partner
107 0 4

Hi, MitchEFFY. I also think that it's better (faster and easier) to use a special app. As a choice - Bulk Discount Manager. It allows creating discounts or tiered pricing for one product, multiple items or collections. There is a tag option, where you can tag your products and create smart collections which will automatically include products with certain tags.

How it may work for you:

1. You create a collection, for example, "Daily Deals"

2. Set up a discount or tiered pricing for this collection (as a fixed amount or %)

3. Tag the products you want with "Daily Deals"

4. These products are automatically included in the "Daily Deals" collection and applied for its discount.

There is an FAQ how to set it up.

eCommerce Solutions Developer
0 Likes
Highlighted
New Member
6 0 0

anyone knows how to do automatic tiered pricing in one collection? for example: buy 1 item in the collection 10% off, buy 2 items in the collection get 20% off. the discount is applied to all items in the collection, not just a volume of one item.

thank you!

 

0 Likes
Highlighted
Shopify Expert
142 0 26

You can achieve Discount by product tags using Automatic Discount.

 

324a1df455c6894dae373ebd45dee9cb.gif

0 Likes