Examples

Add and update customer tags with Shopify POS

Josh
#pos

With the ShopFields app you can capture information in Shopify Point of sale and apply it to the customer as a tag or metafield. This could be data like a referral code to track how a customer found out about you or run an affiliate program.

With ShopFields and Shopify Flow, tags can easily be added to a customer’s profile when a new point of sale order has been created. Using an extra step we can also update any existing tags so that the customer’s referral code is kept up to date with their most recent in store purchase.

In this example we’re using customer tags, but you might find metafields better to work with.

Create our field

Here’s our list field we’ve created by opening the ShopFields app in the Shopify admin:

screenshot of custom fields shopify app with list configured

The main things to note are:

Create a Shopify Flow

Using Shopify Flow we can create an automation that will:

  1. Listen for any orders created
  2. Check if they have a custom attribute applied to the order.
  3. Check if they have an existing customer tag that contains ‘referral’, and if so remove it
  4. Add the new customer tag

screenshot of shopify flow to add and update customer tag

We use Shopify’s Liquid template language to filter out the tags we need.

For removing the tag we just want to see if any of the customer’s existing tags contain ‘referral’:

{% for tag in order.customer.tags %} {% if tag contains 'referral' %} {{ tag }} {% endif %} {% endfor %}

For adding the tag we want to find the right attribute based on the ‘referral’ key we set when creating our field in the ShopFields app, and then create our final referral:code tag:

{% capture referralCode %}
  {% for attribute in order.customAttributes %}
   {% if attribute.key == 'referral' %}
      {{ attribute.value }}
   {% endif %}
 {% endfor %}
{% endcapture %}
referral:{{ referralCode | strip}}

Switch on the Flow and you’re good to go. You can open up point of sale, add a customer and products to your cart and then add the custom field.

screenshot of custom fields shopify app with list configured
We're using a list option here to provide a list of values for staff to choose from
screenshot of pos cart on iphone with custom field applied
The field is applied to the point of sale cart

screenshot of admin

Our customer tag has been updated

Troubleshooting and next steps

If you’re running into issues, the first thing to check is the Flow run history. Make sure it’s firing as expected. ChatGPT is useful for generating liquid snippets, but I found it hallucinated with liquid a bit so I would use version >4.0.

← Back to Examples