I haven’t had a chance to explore the Functions option yet. Would love to hear if anyone else has!
Here, i’ve used this. Install or open Shopify Scripts app, create a new script, choose line item, blank from template.
copy and paste this code:
DISCOUNT = 0.10
CUSTOMER_TAG = "test-discount"
MESSAGE = "MESSAGE TO DISPLAY FOR DISCOUNT"
class DiscountBasedOnTag
def initialize()
end
def run(cart)
if !Input.cart.customer.nil? and Input.cart.customer.tags.include?(CUSTOMER_TAG)
cart.line_items.each do |line_item|
line_item.change_line_price(line_item.line_price * (1-DISCOUNT), message: MESSAGE)
end
end
end
end
CAMPAIGNS = [
DiscountBasedOnTag.new()
]
CAMPAIGNS.each do |campaign|
campaign.run(Input.cart)
end
Output.cart = Input.cart
for the variables at the top, swap in your desired values. discount works as a decimal, so 0.10 is 10%, 0.20%, etc
The message is what will display in the cart under the changed price.
the CUSTOMER_TAG needs to be an exact match to the tag you will apply to your customer profiles.
I kind of have to thank shopify for being so negligent here. If it wasn’t for their lack of basic features, i wouldn’t have learned how to use the scripting engine, which has actually opened a ton of doors for promotions that we can’t do natively.
Shopify Scripts are deprecated, and will be removed on August 28th 2025; you can find more information in the Shopify Help Center: https://help.shopify.com/en/manual/checkout-settings/script-editor
Also, Shopify Scripts is only available in Shopify Plus, so unfortunately, most stores won’t be able to use it to solve this problem.
Hi -
Not sure if you all are still looking for this to be done as Native by shopify (cause it has been 4 years) but you can try the Discount Depot App which offer discounted prices on your products and collections, on the basis of tags (wholesale, retail, trade etc) that means your product will show different price to different customers on the basis of the tags assigned to them.
App URl https://apps.shopify.com/custom-pricing-shipping
Let me know if you find this app suitable for your stores.
I have been using the same app for my clients.
You’re right, I didn’t find a way to do it 4 years ago when I wrote this.
We switched platforms because of it. (I’m a happy Wix user these days with
two different companies on it)
But I didn’t know how to cancel this stream of conversation and frankly
find it humorous to follow all these years later…that Shopify still
doesn’t provide such a basic capability as part of its base. I only have to
use one independent app on my current platform (shipping) and LOVE having
just one major company to deal with.
Good luck with your app
al
Any update on this? we dont want more apps, its a basic function that you would assume exists. You can already add a fixed discount for customers but they have to enter a code. why can that be set to automatic if chosen?
question was posted over 3 years ago with many requests. its got to be fairly simple or is it because more money is made from the apps?
It’s part our their business model, some things will never change.
Hi Tobe, this looks promising and very reasonably priced. I had a couple questions after going through the demo.
- In the demo when you get to checkout the discount code field with the apply button is showing. If you don’t have any normal discounts set up would this be hidden like it is normally? And if not, would it still be hidden for any customer who is not tagged with the discount?
We like to keep this field hidden as it just prompts people to go look for a discount and hurts conversion, so we’re looking for a way to offer a discount to specific customers without showing the field.
- What are the options for applying a discount to a customer? Mainly interested in if it can it be set up for one-time use (get 10% off your next order) and will just stay in their account until they use it, and then go away after that.
Thanks!
This thread is 4 years old and this feature still doesn’t exist? It has nearly 50k views, clearly the people want this.
Found this on another community page. This video will teach you how to use liquid in the theme to apply a discount code based off a users tag: https://www.youtube.com/watch?v=id-U46Lljz0 .
Reading the comment this may have been broken at some time. I am going to try and will update this comment if it works.
Please add customer segmentation to automatic discounts!
Or at least an app which can do this. Using tags is not optimal.
Reading through the posts… 4 years 3 months and still no proper response from Shopify???
Apps… Apps… Apps… Always their response. Sorry, but I’m not giving away my profits to someone else for something so menial.
This has been our work around for years… not pretty but it works. (can’t remember where I found this)
It basically automatically ads the coupon code at checkout (through the checkout button) to customers with specific tags. - However... They must be logged in to their account for this to work.
Then I added this code so that logged in customs will see what their approximate savings will be.
```markup
- {{ 'general.cart.subtotal' | t }}
{{ cart.original_total_price | money }}
{% if customer.tags contains 'Tax Exempt' %}
Taxes
Exempt
{% endif %}
{% if customer.tags contains 'WHOLESALE' and cart.total_price <25000 %}
You do not meet the **$250 minimum** amount for wholesale discount
{% else %}
{% if customer.tags contains 'WHOLESALE-NEW' and cart.total_price <50000 %}
You do not meet the initial **$500 minimum** amount for wholesale discount
{% else %}
{% if customer.tags contains 'WHOLESALE' or customer.tags contains 'WHOLESALE-NEW' %}
Wholesale Discount
- {{ cart.total_price | times: 0.30 | money }}
{% else %}
{% if customer.tags contains 'VIP Level 3' %}
VIP Level 3 Discount
- {{ cart.total_price | times: 0.15 | money }}
{% else %}
{% if customer.tags contains 'VIP Level 2' %}
VIP Level 2 Discount
- {{ cart.total_price | times: 0.10 | money }}
{% else %}
{% if customer.tags contains 'VIP CLUB' %}
V.I.Bead Club Discount
- {{ cart.total_price | times: 0.10 | money }}
{% else %}
{% if customer.tags contains 'VIP Level 1' %}
VIP Level 1 Discount
- {{ cart.total_price | times: 0.05 | money }}
{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}
{% if customer.tags contains 'Tax Exempt' %}
{% else %}
If you have a Status Card and wish to use it online, click
**[HERE](https://www.ibeadcanada.com/pages/first-nations-tax-relief-faqs)** before Checking Out to learn how.
{% endif %}
Like I said… not pretty… but hey! It works.
Sorry for replying to an older thread, but I am stuck…
I’m looking to use Metafields to have the dicounted price of the product and when a customer with a specific tag logs in, they are presented with the pricing from the MetField. Is that possible with Functions?
Would your app be able to take a dollar amount from a Meta Field to apply the discount?
Not being able to select customer segments for automatic discounts while being able to do it for discount codes makes no sense. Why has this feature not been added yet?
Hi You can try using the Discount Depot App offering the same functionality at a very reasonable rate.
@Shopify_77 It’s been four years. Is there a reason this still hasn’t been implemented. You already have Customer eligibility with discount codes. Why can’t it be included in the automatic discounts? It seems unfair to force us to pay an additional amount to use an app, for what should be a simple feature.
They limit the basic functionality so that you have to pay for Shopify Plus. Another great example is reporting… you have to pay more to get better reporting… I mean seriously Shopify…
Why is this still not possible in 2023?
Note that the customer.tags code given here loads from the CART, ON CLICK of the CHECK OUT BUTTON. So to test it, you can’t just refresh the Checkout page. You need to back out to the Cart and reload, then click the Check Out button to to load it into the Checkout.
That right there was a couple hours of frustration for me, so thought I’d spare someone else that pain!