Skip to content

Birthday email and coupon

This example collects a birth date with UpForm, saves it to a Shopify customer metafield, creates a birthday discount, and schedules a daily check that can send email through your email marketing app.

Enable Shopify Flow in UpForm before you build these workflows. See Shopify Flow.

Set up the form

Create a form with an Email field and a Date field for the birth date.

Birthday form with Email and Date fields

Set the field names to email-1 and date-1.

Set email-1 and date-1 field namesBirthday form field name settings

Create the birth date metafield and segment

  1. In Shopify admin, go to CustomersSegments.
  2. Click Create segment.

Shopify Customers Segments page

  1. Open Templates, search for birthday, and select Customers with a birthday today.

Create Shopify customer segmentBirthday today segment template

  1. Click Add metafield. Shopify creates the standard facts.birth_date metafield.
  2. Select the template again, then click Run.

Add facts birth_date metafield

  1. Name the segment Birthday today and click Save. You will use this segment for the discount later.

Save Birthday today customer segment

Build the sync workflow

  1. Open Shopify Flow and click Create workflow.

Create workflow in Shopify Flow

  1. Click Select a trigger.

Select a trigger in Shopify Flow

  1. Choose UpFormNew UpForm Submission.

Choose New UpForm Submission triggerUpForm New UpForm Submission trigger selected

Get customer data

  1. Click + under the trigger, then choose Action.

Add Action under Flow triggerChoose Action step in Shopify Flow

  1. Search for and select Get customer data.

Select Get customer data action

  1. Open the action. Under Select a query to filter data, choose Advanced – Write a query for custom use cases.

Advanced query for Get customer dataWrite custom Get customer data query

  1. In Edit query, paste:
email:{{ submission.fields | where: "name", "email-1" | map: "value" | first }}

Paste email query in Get customer data

For each loop

  1. Click + under Get customer data, choose Action, and select For each loop (iterate).

Add For each loop action

  1. Open the loop. Under Items, open Select variable.
  2. Under Get customer data, select getCustomerData (list of customers).

Select getCustomerData loop items

Update customer metafield

  1. Click + under Repeat for each item (not under the main loop step), then choose Action.

Add action under Repeat for each itemChoose action inside For each loop

  1. Select Update customer metafield.

Select Update customer metafield action

  1. Confirm Customer is set to getCustomerDataForeachitem.id (usually filled automatically).
  2. Under Metafield, select Birth date (facts.birth_date).

Set Birth date metafield value

  1. In Value, paste:
{% for fields_item in submission.fields %}
{% if fields_item.name == "date-1" %}
{{ fields_item.value }}
{% break %}
{% endif %}
{% endfor %}

Birth date metafield Liquid value

  1. Click Turn on workflow.

Turn on birth date sync workflow

Create the birthday discount

  1. In Shopify admin, go to DiscountsCreate discount.

Shopify Discounts Create discount

  1. Choose Amount off order.

Choose Amount off order discount

  1. Configure the discount, for example:
    • Method: Discount code
    • Discount code: HAPPYBIRTHDAY10
    • Discount value: Percentage, 10
    • Eligibility: Customer segments

Configure birthday discount code and value

  1. Add the Birthday today segment, then click Add.

Add Birthday today segment to discount

  1. Click Save.

Only customers in that segment can use the code on their birthday.

Schedule the birthday email workflow

Create a second Flow workflow that runs on a schedule and sends email through your email marketing app.

  1. In Shopify Flow, create a new workflow.
  2. Select the Scheduled time trigger.

Create scheduled time Flow workflow

  1. Set the Time zone, Start date/time, and Repeat (for example, every 1 Days).

Configure scheduled time trigger settings

  1. Add an Action for your email app (for example, Klaviyo, Omnisend, Mailchimp, Brevo, or Twilio SendGrid).

Add email app action to scheduled workflow

Exact email setup depends on the app you choose. Follow that app’s documentation to finish the template and include your discount code (for example, HAPPYBIRTHDAY10).

If this does not work as expected, Contact for help.