When running a Shopify store, you'll frequently encounter the need to categorize orders and customers based on which discount (coupon code) was used, and to leverage that for future marketing and customer support. For example, you might want to send a follow-up email to customers who used a specific campaign code, or specially manage orders that used a first-purchase-only discount.
Doing this manually requires checking the discount details for every order and adding tags accordingly, which is extremely time-consuming. However, using Shopify Flow, you can fully automate this task.
This article explains in detail how to use Shopify Flow to automatically add order tags and customer tags based on the discount used when an order is placed. Since the setup method differs depending on the combination of the discount's "application method" (automatic discount / discount code) and "discount type" (order / product / shipping), we'll walk through specific steps for each case.
Types of Discounts
Shopify discounts come in the following types.
Application Method
Shopify discounts have two application methods: "automatic discount" and "discount code." Since the condition items (variables) used in Shopify Flow differ depending on the application method, you need to know in advance which application method your discount uses.
- Automatic discount: An automatic discount is applied automatically once the conditions are met.
- Discount code: A discount code is applied when the customer directly enters the code into the discount code field on the checkout page after the conditions are met.
The differences between automatic discounts and discount codes are explained in detail in the blog article below. Please use it as a reference.
Discount Type
Shopify discounts have three discount types: "product discount," "order discount," and "shipping discount." Just like the application method, the condition items (variables) used in Shopify Flow differ depending on the discount type, so you need to know this in advance.
- Order discount: A discount applied to the order itself. This corresponds to discounts created using "Amount off order" on the discount page.
- Product discount: A discount applied to product pricing. This corresponds to discounts created using "Amount off products" or "Buy X Get Y" on the discount page.
- Shipping discount: A discount applied to shipping fees. On the discount page, this corresponds to discounts created using "Free shipping."
For more details on discount types, please refer to the blog article below.
How to Add Tags Based on Discounts
In this section, we'll introduce how to use Shopify Flow to "automatically add an order tag or customer tag based on the automatic discount used when an order was placed." If you haven't set up Shopify Flow yet, please read from "Preparation" in order. If you've already set up Shopify Flow, please check from "Step 1."
Preparation: Install Shopify Flow

Source: Shopify Flow|Shopify App Store
(1) Access the Shopify Flow app page from the Shopify App Store
(2) Click "Install"
What Is Shopify Flow?
Shopify Flow is a Shopify-native app that automates all kinds of tasks and processes that arise in store operations. It used to be available only on the Advanced plan, but since July 2023, it has also become available starting from the Basic plan. Shopify Flow can be installed for free from the Shopify App Store. It's a service similar to automation tools like Zapier and IFTTT.
For more details on Shopify Flow, please refer to the blog article below.
Step 1: Set "Order Created" as the Trigger

(1) Open the Shopify Flow app
(2) Click "Create workflow"

(3) Click "Select trigger"

(4) Add the "order created" trigger
Step 2: Set the Discount Variable in the Condition

(1) Hover the mouse over the "Order Created" step added in Step 1
(2) Click the "+ (plus) icon"
(3) Click "Condition"

(4) Click "Add variable"
(5) Add the following variable depending on the "application method" and "discount type"
- For automatic discount & order discount: Order > discountApplications > AutomaticDiscountApplication > title
- For automatic discount & product discount: Order > lineItems > discountAllocations > discountApplication > AutomaticDiscountApplication > title
- For automatic discount & shipping discount: Order > shippingLines > discountAllocations > discountApplication > AutomaticDiscountApplication > title
- For discount code & order discount: Order > discountApplications > DiscountCodeApplication > code
- For discount code & product discount: Order > lineItems > discountAllocations > discountApplication > DiscountCodeApplication > code
- For discount code & shipping discount: Order > shippingLines > discountAllocations > discountApplication > DiscountCodeApplication > code

(6) Enter the following Code (or Title) for the variable added in (5)
- Automatic discount: Enter the discount title into the variable's Title
- Discount code: Enter the discount code into the variable's Code
Step 3: Set Up Tagging as the Action

(1) Hover the mouse over the condition added in Step 2
(2) Click "True"
(3) Click "Action"
(4) Add the action for the tag you want to apply
- To add an order tag: Add the "Add order tags" action
- To add a customer tag: Add the "Add customer tags" action

(5) Add the tag you want to apply to the Tags field of the action added in (4)
Step 4: Turn the Workflow On

(1) Once you've completed the settings through Step 3, click "Turn on workflow"
Step 5: Test the Behavior

(1) Place an order using a discount

(2) Check that the tag has been added as intended
Once you've confirmed the tag was added as intended, the setup is complete.
ℹ️ In this article, we set up a workflow that automatically adds the "TEST" tag to the customer when the discount code "TEST_CODE" (an order discount applied via a discount code) is used.
In Closing
This article introduced how to use Shopify Flow to automatically add order tags and customer tags based on discounts.
The variable referenced in Flow differs depending on the combination of the discount's application method (automatic discount / discount code) and discount type (order / product / shipping). Before setting things up, it's important to check which type the target discount falls under.
This automation allows you to efficiently manage and segment customers who use discounts, improving the quality of subsequent marketing initiatives and customer support.
Shopify Flow has many other templates and use cases available. Be sure to use it to streamline your store operations.


