How it works

Follow these 9 simple steps to start generating unique product discount codes for new customers automatically

Shopify logo icon

Customer Created

App connector: Shopify • Time to complete: 1 minute
Why this matters: This trigger captures new customer account creations the instant they occur, enabling immediate discount code generation that can be sent via SMS while the customer is still engaged and likely to make their first purchase.

When a customer account is created in Shopify (through online checkout, in-store signup, admin creation, or API), this trigger activates the workflow and captures customer ID, email, phone number, name, and account creation timestamp. The workflow runs for every new customer account. No configuration is required—it's pre-connected to your Shopify store and monitors customer creation automatically.

New customer context: This includes customers who create accounts during checkout and customers who sign up via account pages. Guest checkouts that don't create accounts won't trigger this workflow.

Create Price Rule

App connector: Shopify • Time to complete: 8 minutes
Why this matters: Creates the Shopify price rule that defines discount parameters including value, eligible products, customer restrictions, and expiration, establishing the discount foundation that enables unique code generation.

This step creates a Shopify price rule with specific configuration.

Configuration: You must set several values during setup:

  1. Discount value: The discount amount (default -20 for 20% off)
  2. Value type: Either "percentage" or "fixed_amount"
  3. Expiration date: How long the code is valid (default 14 days)
  4. Entitled product ID: Which product the discount applies to

Price rule structure:

  1. title: "NEWCUSTOMER [customer_id] [timestamp]" (unique identifier)
  2. allocation_method: "across" (discount spreads across eligible items)
  3. value: Your configured discount amount
  4. value_type: Your configured type (percentage or fixed)
  5. target_type: "line_item" (discount applies to products)
  6. customer_selection: "prerequisite" (only specific customers can use)
  7. starts_at: Immediately (current timestamp)
  8. once_per_customer: "true" (each customer can use once)
  9. target_selection: "entitled" (specific products eligible)
  10. ends_at: Your configured expiration (default 14 days from now)
  11. entitled_product_ids: Your configured product ID
  12. prerequisite_customer_ids: The new customer's ID (restricts to this customer only)
  13. prerequisite_subtotal_range: Minimum $1 order (prevents abuse)

This creates a single-use, customer-specific, product-specific, time-limited discount.

Finding product ID: Go to Shopify admin > Products > select product > look at URL > copy numbers after /products/.

Retrieve Price Rule

App connector: Shopify • Time to complete: 0 minutes (Auto-configured)
Why this matters: Fetches the complete price rule record including the price rule ID needed for discount code creation, verifying successful creation before proceeding.

This step retrieves the price rule using the price rule ID from the creation response. It returns complete price rule data including ID, title, discount parameters, eligible products, customer restrictions, and expiration dates. The price rule ID is used in the next step.

Create Price Rule Discount Code

App connector: Shopify • Time to complete: 0 minutes (Auto-configured)
Why this matters: Generates the actual discount code that customers will enter at checkout, creating a unique, memorable code tied to the customer-specific price rule.

This step creates a discount code under the price rule. Code format:

  1. code: "NEWCUSTOMER[customer_id]" (like "NEWCUSTOMER12345678")

The code is automatically associated with the price rule, inheriting all discount parameters, restrictions, and expiration settings. The unique customer ID ensures each customer gets a different code for tracking and preventing sharing.

Code customization: You can modify the code format to match your brand (like "WELCOME[customer_id]" or use random strings), but ensure it remains unique per customer.

Customer Add Tag

App connector: Shopify • Time to complete: 0 minutes (Auto-configured)
Why this matters: Tags the customer with their discount code in Shopify admin, enabling easy lookup of which codes belong to which customers and tracking which customers received welcome offers.

This step adds the discount code as a customer tag. The tag format matches the code (like "NEWCUSTOMER12345678"), creating a permanent record in the customer profile. This enables:

  1. Quick customer service lookups ("What was this customer's welcome code?")
  2. Segment creation for customers who received welcome offers
  3. Reporting on welcome offer redemption rates
  4. Bulk actions on customers with welcome codes

Retrieve Product

App connector: Shopify • Time to complete: 0 minutes (Auto-configured)
Why this matters: Fetches complete product information including product title needed for personalizing the SMS message with the specific product name customers can use their discount on.

This step retrieves the product record using the entitled product ID from the price rule. It returns product data including title, description, images, and pricing. The product title is used in the SMS message to clearly communicate which product the discount applies to.

Retrieve Shop

App connector: Shopify • Time to complete: 0 minutes (Auto-configured)
Why this matters: Fetches your store name for personalizing the SMS message with your brand name, making the text message feel authentic and branded rather than generic.

This step retrieves shop information from Shopify, specifically the shop name. This name appears in the SMS message like "Thank you for shopping with [Your Store Name]", creating a branded customer experience.

Filter: Phone Number Check

App connector: Filter • Time to complete: 0 minutes (Auto-configured)
Why this matters: Verifies the customer has a phone number before attempting SMS sending, preventing workflow failures and ensuring SMS only goes to customers who can receive texts.

This filter checks if the customer's phone number field is not empty. If true (phone exists), the workflow proceeds to send SMS. If false (no phone), the workflow stops here. The customer still received their discount code and tag, they just don't get the SMS notification.

Alternative notification: Customers without phone numbers could receive the discount via email instead by adding an email step in a separate path.

sms icon

Send Message

App connector: SMS • Time to complete: 2 minutes
Why this matters: Delivers immediate notification of the welcome discount directly to the customer's phone, providing a convenient, high-visibility channel that drives immediate engagement and first purchases.

This step sends an SMS to the customer's phone number. Configuration: You can customize the message during setup. The default message is:

"Thank you for shopping with [Store Name].

Take 20% off on the [Product Title].

Use online code: [Discount Code]"

SMS best practices:

  1. Keep message under 160 characters if possible (avoids multi-part SMS)
  2. Clearly state discount value and product
  3. Include the code prominently
  4. Consider adding a link to the product page
  5. Ensure discount details match what you configured in price rule

SMS costs: MESA SMS has per-message costs. Consider your customer volume when deciding whether to use SMS vs email.

Make it your own

Customize this workflow even further:

Add email notification
Insert an email step (either replacing or supplementing SMS) that sends a welcome email with the discount code, product image, and call-to-action button, providing a richer notification experience.
Create tiered discounts
Add conditional logic that checks customer tags, order history, or other factors and varies discount amounts for different customer segments, creating VIP welcome offers.
Apply to product collections
Modify the price rule to use entitled_collection_ids instead of entitled_product_ids, allowing the discount to work on any product in a collection like "Welcome Collection" or "First Purchase Items".
Send reminder SMS
Create a companion workflow triggered by a schedule that checks for customers with welcome code tags who haven't placed orders and sends reminder texts before codes expire.

Frequently asked questions

Can customers share their discount codes?
No, the price rule is restricted to the specific customer's ID (prerequisite_customer_ids). Even if someone else obtains the code, it won't work for them. Only the customer who received it can use it.
What happens if a customer creates an account but doesn't provide a phone number?
They still receive the discount code and customer tag, they just won't get the SMS notification. Consider adding an email step to notify customers without phone numbers, or display the code on the post-signup page.
Can I change which product the discount applies to without recreating the workflow?
You'll need to update the configuration in the "Create Price Rule" step. Edit the entitled_product_ids field with the new product ID, and update the SMS message to reference the new product name.
What is a template?
Templates are pre-made workflows by our team of experts. Instead of building a workflow from scratch, these have all the steps needed to complete the task.
Can I personalize a template?
Yes! Every step can be customized to meet your exact requirements. Additionally, you can even add more steps and make it more sophisticated.
Are templates free?
Yes! Our entire library containing hundreds of templates are free to use and customize to your exact needs.

Ready to start generating unique product discount codes for new customers automatically?

Join thousands who've automated their work and saved an average of 3.5 hours every week.

Start with this template — It's free
7-day free trial • 17 min setup • Cancel anytime