Where is the data for custom fields stored?

Customer Fields stores custom data in two places; the app's database and Shopify’s metafields

When a customer record is saved, and the data being saved contains values for custom data columns, then the app will store metadata on the Customer resource/object in Shopify using metafields. This metafield data is accessible via the Shopify API, or on the front-end using Liquid.

The app's metafields are designed to use customer_fields as the namespace, and data as the key. All of the metafield data is stored in a single JSON string. The value of the string contains the app's data column keys and respective data column values.

Metafields are only used for custom fields and data columns

Please note that the data for standard fields and data columns (e.g. first_name, email, phone, etc) will be saved to the normal fields and properties within Shopify. To display standard customer data in Liquid we suggest using Shopify's documentation:

Liquid output

You can use customer metafields in Liquid to access custom data collected by Customer Fields. The most common way to use metafields in Liquid is when editing the code for a store's theme or email notification templates.


To access custom data on the storefront or in email notifications, you will need to use the following syntax:

{{ customer.metafields.customer_fields.data["DATA COLUMN KEY"] }}

❗ Note: You'll need to replace DATA COLUMN KEY with the actual data column key that you wish to use.

Liquid-friendly data types

Since each data column in Customer Fields has its own specific data type, you can apply type-specific Liquid filters to format the data, or even scope out certain attributes for an object of data.

Below you'll find several different examples of how to display metafield data for a customer:

Specific examples

1) Display value for a custom text data column with the key of 'pet_name':

Your pet's name: {{ customer.metafields.customer_fields.data["pet_name"] }}

<!-- Outputs:
Your pet's name: Franklin

2) Display value for a custom date data column using a Liquid date filter to control the format:

Your Birthday: {{ customer.metafields.customer_fields.data["birthday"] | date: "%b %d, %Y" }}

<!-- Outputs:
Your Birthday: February 6, 1945

3) Display value for a custom list data column using a Liquid filter to convert the array into a comma-separated string:

Your Hobbies: {{ customer.metafields.customer_fields.data["hobbies"] | join: ", " }}

<!-- Outputs:
Your Hobbies: Cycling, Hiking, Video Games

4) Display value for a custom file data column using the URL attribute to embed an image:

Profile pic: <img src="{{ customer.metafields.customer_fields.data["profile_pic"].url }}" style="max-width: 150px;">

<!-- Outputs:
Profile pic: <image> (150px max width)

PDF agreement: <a href="{{ customer.metafields.customer_fields.data["contract"].url }}" target="_blank">{{ customer.metafields.customer_fields.data["contract"].name }}</a>

<!-- Outputs:
PDF agreement: <filename> (hyperlink that opens file in a new tab)

6) Display values for a custom group_list data column using a for-loop to output certain data attributes in the array of objects:

{% for pet in customer.metafields.customer_fields.data.pets %}
Pet name: {{ pet.name }}
Pet weight: {{ pet.weight }}
{% endfor %}

<!-- Outputs:
Pet name: Franklin
Pet weight: 30 lbs
Pet name: Winston
Pet weight: 2 lbs

7) (Advanced) Display values for a custom group_list column using a variable, multiple filters, iteration, and some control flow logic:

{% assign pets = customer.metafields.customer_fields.data.pets %}
<h4>Your Pets ({{ pets | size }} total)</h4>
{% for pet in pets %}
<li>{{ pet.name | capitalize }} ({{ pet.type | downcase }}), {{ pet.energy_level | downcase }}></li>
{% if pet.birthday != nil %}<li> Born: {{ pet.birthday | date: "%b %d, %Y" }}</li>{% endif %}
{% endfor %}

<!-- Outputs:
Your Pets (2 total)

Franklin (dog), lazy
Born: October 10th, 2015

Winston (hamster), active

Looking for more technical details? 🤓

Learn more about the app's metafields using our Developer Documentation.

Did this answer your question?