Customer metafields in Shopify Email custom liquid block?

Is it possible to insert a customer metafield into a Shopify Email message using the Custom Liquid block?

I’d like to send unique discount codes to customers this way. The Email Personalization feature is very close, but it only accesses name/address info.

I have found tutorials on how to display customer metafield data using Liquid on store pages, but not sure how to specify which customer’s metafields it should be pulled from when doing this via the email builder code block.

Ideally I would include custom liquid code in the email block, and the code would point to the recipient of the email as the customer whose metafield should be accessed/displayed.

2 Likes

Found the help page with all the available Liquid variables for custom code blocks in email. Unless someone knows of another way to do this, I think this pretty much means this idea isn’t possible.

So frustrating as all pieces are right there, but no way to connect them.

1 Like

Hello there!

Yes, it is possible to insert a customer metafield into a Shopify email message using the custom Liquid block.

A metafield is a way to store additional information about an object in Shopify, such as a product, an order, or a customer.

To insert a customer metafield into a Shopify email message, you will need to use the Liquid programming language. You can access the Liquid code by navigating to the “Online Store” section of your Shopify admin panel, then clicking on “Themes” and finally “Actions” and select “Edit code”.

You can create a custom Liquid block and insert it into the email template. In the block, you can access the customer metafield using the following code: {{ customer.metafields.namespace.key }}, where “namespace” and “key” are the specific namespace and key of the metafield you want to access.

For example, if you have a metafield with the namespace “membership” and the key “level”, you can access it in the email template using the following code:
{{ customer.metafields.membership.level }}.

You can insert this code into the email template where you want the metafield to be displayed.

It’s worth mentioning that you must have already created the metafield you want to use, if not, you should create it first.

The method you are describing sounds like it will edit the template for the individual email messages sent when clicking on a customer’s email address link in the Shopify admin.

I was referring to the “Shopify Email” app. I want to be able to send emails to a customer segment, but have the messages customized using content pulled from the customer metafields.

Shopify Email app will allow for Custom Liquid blocks to be used, but those blocks do not seem to be able to pull data from customer metafields. The Shopify Email app also has a “Personalization” feature for customer data, but is currently limited to name and address fields in the customer account.

3 Likes

Customer metafields in email don’t work for me.

Steps to reproduce:

  1. Create a new Customer metafield myfield (with a “custom” namespace, so with namespace it’s “custom.myfield”)
  2. Create a dummy customer with your own email address, set a value in that field for yourself
  3. Add a liquid block somewhere on the website (i.e. at the bottom of the Cart page) with just this text: {{ customer.metafields.custom.myfield }}
  4. Login with that email and visit the Cart page => verify the value of the field is present
  5. Create an email template adding a liquid block and inside that block having exactly the same code that worked on a Cart page: {{ customer.metafields.custom.myfield }}
  6. Start an email campaign by only including your own email in the mailing list
  7. Open an email and verify that there is no value for {{ customer.metafields.custom.myfield }}

Not having this feature limits the use of powerful apps that rely on custom fields, I’d really love if customer metafields were supported by email marketing campaigns.

2 Likes

Would really love this solved. Email marketing is very limiting if I’m not able to integrate email with Marketplace apps which rely on metafields.

4 Likes

Very frustrating that most Shopify included apps go 90% of the way. Tags is an element of the customer object and should work. If you use the tag in an email template it jsut puts out a blank even though there is data in the tags. {{data.customer.tags.first}}

I have discovered the same problem. Did you find a solution? I’ll need to create an App to resolve this if it’s not possible through Liquid.