Apply automatic discount to tagged customers

jjansen
Tourist
6 0 53

Our store has a member discount and frequently offers member discounts on special events.  Is there a way to tag certain customers as a member, then have an item automatically discounted? Discount codes distributed to members only frustrates them if they can't find/remember the code, and could also be passed to non-members or wind up on some on-line coupon list.

Replies 144 (144)
ASis
Excursionist
18 0 11

Guess what guys!? It works like a charm! Your selected tagged customers and your auto discount! Thank you Regios Technology!!

ASis
Excursionist
18 0 11
AtlasWebmaster
Tourist
10 0 8

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!

Gloomrains
Tourist
4 0 5

I would like to add my vote for support in this becoming a native feature, and frankly, I was very surprised to find it wasn't already. I actually can't believe the official response from Shopify was to 'buy an app'. You are genuinely suggesting your customers spend upwards of $30USD a month for an external app to simply tag specific customer groups for automatic discounts? Shopify, are you serious? That's extortion.

 

Please add this feature @Shopify

gxvna
Visitor
1 0 1
Click to expand...
I am also looking for the same solution to this problem. I already have so many apps downloaded. A simple function as such shouldn't require a $30 per month app.

Drew111
Tourist
6 0 8

Add it. Wake up and add it. Do it now. Make it native to the software. Do it. Do it. Do it. now.

LS_Hamburg
Excursionist
11 0 5

I'm just building my store now. Researched every possible method of doing a wholesale part of my website. And somehow I am now just coming across the most simple option, which is to allow automatic discounts for tagged customers or specific customers. Discount codes have specific customers, but automatic discounts do not, because of course this would directly enable the wholesale part of your website.

 

This isn't like my little 'Instafeed' app, for example. This should be a core function of Shopify. 

 

And most wholesale apps cost at least the same MONTHLY price as Shopify itself, at least doubling your website cost? Get out of here.

 

Anyone have any alternatives to Shopify to have a simple price reduction for certain customers?

 

This is really annoying me. I have put so much time into adapting this website to how I want it to, adding some things that I thought should already be there. This is really the final straw. I'm looking at alternatives to @Shopify now.

Andrew_Silver
Visitor
1 0 7

This would be an awesome and simple feature. Maybe with Shopify stock down 70% YTD they will listen to what their customers want.

HBNick
Visitor
1 0 2

I'm blown away that after this long Shopify still does not bother to bake in functionality that almost all of its user-base would utilize. 

jsciabica
Excursionist
19 0 63

As @nathanhelloari mentioned, Customer Segments are currently available for Discount Codes!  It's much more powerful than customer tags, so that's much appreciated, BUT WE NEED IT FOR AUTOMATIC DISCOUNTS.

 

Shopify has been on a good path with new features like Customer Segments and Merge Customers. I am hopeful that much-needed, long-overdue features like this will be added in short order.

Holly131
Tourist
3 0 2

Still not able to do this. I could really use this! I'm actually surprised we can't tag customers for a private discount

ryanleichty
Shopify Partner
3 0 3

Adding my support for this feature as well 👍 We have a customer segment that we want discounts applied to automatically rather than requiring them to add them themselves.

tobebuilds
Shopify Partner
212 12 67

Hey, Ryan, this is almost possible now with Shopify Functions. You can't check whether a customer is in a segment, but you can at least check whether a customer has a given tag, and apply a discount accordingly.

 

https://shopify.dev/docs/api/functions/reference/order-discounts/graphql/common-objects/customer

 

That's what I ended up using in my automatic discount app. Not sure what your setup is, but I reached out to the Shopify Functions developers today to ask if there are any plans to add support for segments soon. No response yet, but hopefully they have something in the works!

sjmet
Excursionist
18 0 1

CRAZY that this function isn't available yet. Apps don't even offer this functionality.

iccagus
Excursionist
17 1 1

Hi @sjmet 

 

Isn't this just part of Shopify? I was able to create discounts that are tagged and had no issues creating new products and attaching the discount codes to that products.

 

Please explain what exactly the issue is here. It seems it's been fixed now... is it?

Denise-in-NZ
Excursionist
11 0 15

Hi @iccagus ,  I think you are referring to discounting a tagged product. We are refurring to discount to a tagged customer. You cannot tag a customer group, say VIP, and give a discount to only your VIP customers.

iccagus
Excursionist
17 1 1

Hi @Denise-in-NZ But there's a huge caveat in that.

 

 

So, let's assume:
You have a VIP customer A. Their email ID is: john@example.com for example.
(Since all the customers are identified in Shopify via their email)

Now if they come back another day, and use their email - well they should get a discount. That's the expected behaviour. It's good.

But, what if someone else simply puts in John's email for whatever reason? Well, then they will get the discount on John's behalf.

That's a huge security flaw. And, one of the ways to bypass this is by verifying if John is the one utilizing the discount, and no one is impersonating them through his email.

 

Hope this helps!

Please let me know if I missed something.

 

Cheers!

sjmet
Excursionist
18 0 1

Not if accounts require login...

Metric_Boom
Shopify Partner
2 0 1

Our devs were able to overcome this challenge using Shopify scripts alongside tagging.  This obviously only applies if you, or your client, is on Shopify Plus.  

 

We've implemented this for a client and it's been working well now for the past 3-4 weeks alongside discount codes and gift cards.  Everything is 100% native. 

 

The client we speak of was on Wholesale Gorilla for about a year.  We then tried out Shopify B2B for about 6-months but gave up on that due to all sorts of bugs.

The MacGyver of eCommerce | Revenue Optimization Expert | 26 Years of Omnichannel E-commerce Experience

Metric Boom is a boutique e-commerce consulting agency offering business strategy, custom dev, operations optimization, systems, inventory planning, and more. For established brands, we offer fractional c-suite services.
Gabe_Stillwater
Excursionist
22 0 34

Sharing is caring... 

SingleLength
Excursionist
13 0 17

Big surprise, another blatantly obvious missing feature which SHOULD be part of the platform and people have been BEGGING for it for years, and Shopify does nothing about it. I can create a discount code and filter customer eligibility by things like Specific Customer Segments or Specific Customers, but when I select Automatic Discount that option goes away. WHY? WHY? WHY!?! That makes absolutely no damn sense. 

sjmet
Excursionist
18 0 1

Check out the app ADG -- Discount & Gifts.

It fills that space for now, until Shopify implements this very basic feature.

tobebuilds
Shopify Partner
212 12 67

Hey, I'm working on a new app to solve this problem. It'll be free for early adopters, so send me a DM if you're interested.

 

Now that Shopify Functions are available for all stores, it's possible to create discounts with practically unlimited logic, that will load fast as well. So if you're not wanting to use an app, you should use Functions on your store directly.

Denise-in-NZ
Excursionist
11 0 15

Not sure if you are still looking (cause it has only been 4 years) but give this new app a go... works for me and does everything I think we were looking for   https://apps.shopify.com/regios-automatic-discounts 

FINALLY A SOLUTION! Thank you 

Ram_A
Explorer
60 3 19

Can't the app work using only the Shopify Customer ID? Why does it ask for the customer's name and email data?

 

Personally, I don't want to share my customers' data with a third-party app. This feature should be built into Shopify.

tobebuilds
Shopify Partner
212 12 67

Hi Ram, I'm Tobe, the developer of Regios Automatic Discounts.

 

The customer's name and email data is not stored on the app servers at all. It is only used for the "Search customers" functionality, as shown in these screenshots:

 

tobebuilds_0-1689357242727.png

tobebuilds_1-1689357322766.png

 

 

The actual data associated with the discount is sent to Shopify via their GraphQL API, and stored on their servers.

Ram_A
Explorer
60 3 19

I’ll check it out. Thnx

tobebuilds
Shopify Partner
212 12 67

Reply in this thread if you have any further questions, and I'll be happy to answer!

 

I have no intentions to ever retain stores' customer data on my server. Doing so would be a privacy and security minefield.

 

If anything, I'm lucky that Shopify Functions allow metafield configuration - this is the only place customer data is stored, and that's hosted by Shopify themselves.

ASis
Excursionist
18 0 11

It works beautifully just adding the tag to your customer! You then develop a new discount with that tag.

cglaspell
Excursionist
21 1 6

Whoa, I just found this whopper of a thread-after posting a very similar question too. I searched in here before posting as well, but came about this thread from google search. So-did this get resolved?

mmshopkeeper
Tourist
4 0 6

We're still waiting!  But I'm going to look into the Functions option that someone mentioned above...

cglaspell
Excursionist
21 1 6

Any luck on the Functions option?

mmshopkeeper
Tourist
4 0 6

I haven't had a chance to explore the Functions option yet.  Would love to hear if anyone else has!

JeffSpurlock
Shopify Partner
9 0 11

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.

tobebuilds
Shopify Partner
212 12 67

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.

Ankit_Thakur
Shopify Partner
55 1 6

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.

Shopify Developer/Consultant
If my suggestions are useful, please let me know by giving it a like or marking it as a solution.
And if you want to customize or develop new feature on Theme or App.
Skype:-ankit.thakur_5
Glassy_Al
Tourist
9 0 16
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

BarumbaPlay
Tourist
8 0 0

This thread is 4 years old and this feature still doesn't exist? It has nearly 50k views, clearly the people want this.

Nick_Johannsen
Visitor
1 0 0

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. 

Contrail
Shopify Partner
17 0 2

Please add customer segmentation to automatic discounts!

Or at least an app which can do this. Using tags is not optimal.

 

https://community.shopify.com/c/shopify-apps/automatic-discount-on-x-if-i-already-own-y/m-p/2347884#...

i-Bead
Excursionist
13 0 4

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)

 

<div class="cart-content-item cart-total" data-cart-total>
                            <form action="{{ routes.cart_url }}" method="post" novalidate>
                              {% if customer.tags contains 'VIP CLUB' %}
                                <input class="js-form-discount" type="hidden" name="discount" id="cart-coupon-code" value="VIBeadClub">
                                  {% else %}
                                {% if customer.tags contains 'VIP Level 1' %}
                                  <input class="js-form-discount" type="hidden" name="discount" id="cart-coupon-code" value="VIP1">
                                    {% else %}
                                  {% if customer.tags contains 'VIP Level 2' %}
                                    <input class="js-form-discount" type="hidden" name="discount" id="cart-coupon-code" value="VIP2">
                                      {% else %}
                                    {% if customer.tags contains 'VIP Level 3' %}
                                      <input class="js-form-discount" type="hidden" name="discount" id="cart-coupon-code" value="VIP3">
                                        {% else %}
                                      {% if customer.tags contains 'WHOLESALE' %}
                                        <input class="js-form-discount" type="hidden" name="discount" id="cart-coupon-code" value="WHOLESALE">
                                          {% else %}
                                        {% if customer.tags contains 'WHOLESALE-NEW' %}
                                          <input class="js-form-discount" type="hidden" name="discount" id="cart-coupon-code" value="WHOLESALE-NEW">
                                            {% endif %}
                                          {% endif %}
                                        {% endif %}
                                    {% endif %}
                                  {% endif %}
                                {% endif %}

          <script type="text/javascript">
                /*
                @require
                Jquery: https://jquery.com/
                jquery-cookie: https://github.com/carhartl/jquery-cookie
                
                Allows you to set a discount code via a URL and pass into shopify checkout
                
                https://myshopifystore.com?coupon=MYCOUPONCODE
                can append ?coupon=MYCOUPONCODE to any URL
                
                */
                
                // Get paramaters from the URL
                function getParameterByName(name, url) {
                  if (!url) {
                    url = window.location.href;
                  }
                
                  name = name.replace(/[\[\]]/g, "\\$&");
                  var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
                      results = regex.exec(url);
                  if (!results) return null;
                  if (!results[2]) return '';
                  return decodeURIComponent(results[2].replace(/\+/g, " "));
                }
                // This must be added to your checkout form 
                // <input class="js-form-discount" type="hidden" name="discount" value="RESELLERDISCOUNTCODE" >
                $discountInput = $("input.js-form-discount");
                // set cookie with passed in coupon code to any URL
                $coupon = getParameterByName('coupon');
                if($coupon){
                  // set a cookie with the coupon code
                  // Valid for 7 days : can adjust { expires: 7 } to whatever you want
                  // single / is a session cookie
                  $.cookie('discountCode', $coupon, { expires: 7 });
                }
                // Get cookie discount code value and set form value
                $discountCode = $.cookie('discountCode');
                
                if($discountCode){
                  if ($discountInput.length > 0) { 
                    // if cookie is set and discount input field is on page set its value to cookie val 
                    $discountInput.val( $discountCode );
                  }
                }
            </script>

 

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.

 

<li class="cart-total cart-total-subtotal">
                                        <div class="cart-total-label"><span class="text">{{ 'general.cart.subtotal' | t }}</span>
                                            <div class="cart-total-value"><span class="text">{{ cart.original_total_price | money }}</span></div>
                                        </div>
                                            {% if customer.tags contains 'Tax Exempt' %}
                                              <div class="total-price2_1">Taxes <div class="cart-total2_1" style="float: right;">Exempt</div></div>
                                            {% endif %}
                                            {% if customer.tags contains 'WHOLESALE' and cart.total_price <25000 %}
                                              <div class="total-price1">You do not meet the <b>$250 minimum</b> amount for wholesale discount</div> 
                                            {% else %}
                                            {% if customer.tags contains 'WHOLESALE-NEW' and cart.total_price <50000 %}
                                              <div class="total-price1">You do not meet the initial <b>$500 minimum</b> amount for wholesale discount</div> 
                                            {% else %}
                                            {% if customer.tags contains 'WHOLESALE' or customer.tags contains 'WHOLESALE-NEW' %}
                                              <div class="total-price2">Wholesale Discount <div class="cart-total2" style="float: right;">- {{ cart.total_price | times: 0.30 | money }}</div></div> 
                                            {% else %}
                                            {% if customer.tags contains 'VIP Level 3' %}
                                              <div class="total-price2">VIP Level 3 Discount <div class="cart-total2" style="float: right;">- {{ cart.total_price | times: 0.15 | money }}</div></div>
                                            {% else %}
                                            {% if customer.tags contains 'VIP Level 2' %}
                                              <div class="total-price2">VIP Level 2 Discount <div class="cart-total2" style="float: right;">- {{ cart.total_price | times: 0.10 | money }}</div></div>
                                            {% else %}
                                            {% if customer.tags contains 'VIP CLUB' %}
                                              <div class="total-price2">V.I.Bead Club Discount <div class="cart-total2" style="float: right;">- {{ cart.total_price | times: 0.10 | money }}</div></div>
                                            {% else %}
                                            {% if customer.tags contains 'VIP Level 1' %}
                                              <div class="total-price2">VIP Level 1 Discount <div class="cart-total2" style="float: right;">- {{ cart.total_price | times: 0.05 | money }}</div></div>
                                            {% endif %}{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}
                                            
                                            {% if customer.tags contains 'Tax Exempt' %}
                                              {% else %}
                                                <p style="font-weight: 500; margin: 20px 0 0 0; letter-spacing: .02em; font-size: 12px">If you have a Status Card and wish to use it online, click
                                                  <b><a href="https://www.ibeadcanada.com/pages/first-nations-tax-relief-faqs"><font color="#dc3545"><u>HERE</u></font></a></b> before Checking Out to learn how.
                                       		  </p>
                                            {% endif %}
                                    </li>

 

Like I said.... not pretty..... but hey!  It works.

CannadyShop
Not applicable
3 0 1

@Shopify 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.

jondiego
New Member
9 0 0

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....

Mike5241
Excursionist
48 0 7

Hi everyone,

The following tip worked like a charm for me in the Dawn theme:

https://www.linkedin.com/pulse/how-offer-automatic-discounts-specific-customers-shopify-dematis-tdr1...

 

I hope it helps,

Mike

i-Bead
Excursionist
13 0 4

Wow!  That's much prettier (and easier) than the code I posted over a year ago.  Going to have to try it on my next theme template update.  - Thanks!