Shopify: Automatic Discounts For Tagged Customers

Shopify's automatic discounts can't target tagged customers, but you can use a code solution to push regular discount codes that are customer specific
Froonze
May 7, 2024

If you are familiar with Shopify's automatic discounts, you're likely aware of a key limitation. They can't target specific customer segments. This means that even though you can create discounts that automatically apply at checkout without the need for customers to enter a code, these discounts would apply to all customers in the database.

Unlike automatic discounts, Shopify's (non-automatic) discount codes allow you to target tagged customer segments with a built-in setting. So, as a workaround, you can create one of these segment-specific discount codes and automatically push it to checkout with a code solution added to the theme. As a condition for it to work, the customer will need to previously login and the segment you target will need to be based on an existing customer tag. This tag will be used later to create the conditional code that will push the coupon for those tagged, logged-in, customers.

Shopify: Automatic Discounts For Tagged Customers

  1. So first, make sure your target customers have been assigned a unique tag. In most cases, it's an app that tags the customers based on relevant criteria and/or captured data. You could also tag them manually in Shopify's Customers admin panel or use semi-automatic methods like workflows or imports.
  2. Once customers are tagged, head to Shopify Admin > Customers > Segments to create the tag-based segment. To set it up you'll need to use a filter with the next format, where you replace 'custom_tag' by the name of your unique tag: customer_tags CONTAINS 'custom_tag'
    It's pretty straightforward, like in this picture. But if you need further instructions on how to create the segment, read this other article. Apply the filter and Save the segment.
  3. Now go to the Discounts dashboard to create the discount. You can create an order, product or free shipping discount and make it customer specific with the built-in Customer eligibility setting:

    • Click on Create Discount and select the type of discount
    • For method, select Discount Code. And for code let's say that we use a pre-defined custom code instead of random, named "CUSTOMCODE"
    • Configure other basic discount settings: value (in percentage or amount) and type. You can also optionally set up a minimum order amount required, combinations, or limit of uses (but we don't think you'll want to limit the use of this automatic-like discount)
    • In Customer Eligibility, search and select your custom segment. Once selected you'll see its name below. Save the discount
Shopify discount specific customer segment

Now add a code in the theme files that will automatically apply the code to checkout:

  1. Go to your Shopify admin and navigate to Online Store > Themes. Find the live theme you want to edit and click on the Three points icon > Edit code.
  2. In the Theme Editor, search for the main layout theme.liquid. Open it.
  3. Find the closing </body> tag in the code editor and paste the below script just before it. Replace 'custom_tag' and 'CUSTOMCODE' with your actual values. This script applies the discount only to logged-in customers with the 'custom_tag' tag.
  4. Save and test on site. Log into an account that has the tag, add products to the cart and go to checkout to verify the discount applies. Repeat with another account without the tag to verify that it doesn't apply.

{% if customer.tags contains 'custom_tag' %} <script> window.addEventListener('load', function() { fetch("/discount/{{ 'CUSTOMCODE' }}") }) </script> {% endif %}

Shopify: Automatic Discounts For Specific Customers with free shipping

Logging in during checkout won't push the code to tagged customers

This solution pushes the discount code after the tagged customer logs-in and browse any page on your site. But it doesn't work if customers log in directly on the checkout page because Shopify restricts scripts on the checkout page. To help mitigate this issue, it's a good idea to nudge your customers to sign in and examine their account details before proceeding to checkout. Doing so can also provide them an opportunity to explore discounts and other profile information and tools you consider relevant.

Check our app, Customer Accounts, a comprehensive solution that replaces the account page with a widget that contain custom integrations and content. Including dynamic content based on customer tags (like tag-based discounts). It also features different plugins to upgrade the customer experience. Like a Loyalty Program to create a variety of discounts within a points-based system. Coupled with Custom Forms for collecting additional data that you can use to tag your customers. And many more: Social Login, Wishlist, Order Management,... Find more details in Shopify's App Store.

Froonze Customer Accounts Concierge
Get the app today
Turn the account page into a beautiful portal with
Froonze Customer Accounts Concierge
  • 200+