Skip to main content

How to use Shopify Metafields with Zentail

How to send item attributes to Shopify

Written by Dan Sugarman

A typical Shopify listing is comprised of a title, description, images, and a price. If you'd like to add additional item specifics to the listing without hand writing them into your description you can use metafields. There are two parts to getting metafields to show up on your Shopify listings:

Setting up Zentail to Send Metafields

There are two steps to make sure that Zentail is sending metafield attributes to your Shopify integration(s).

Add a Metafield to your Shopify Integration

First, you'll want to decide the fields that you want to appear on your Shopify site. To set them up, you can head to:

Account > Integration Settings > Shopify > Manage Metafields (orange button).

Here's a quick video adding 'Shirt Color' as a metafield to a Shopify integration:

Note that there are three parts to the metafield:

  1. Display Name - how it will appear on the Shopify listing and your Shopify Advanced Options in Zentail (more on that below)

  2. Name (aka Internal Name) - this can be ignored. It's how Zentail will handle this in our database.

  3. Source Attribute - the value use for the metafield will inherit from this source. For instance, the above video adds 'Shirt Color' as a metafield with 'Color' as a source attribute. So if the Zentail Color is 'Blue' then Shirt Color will be sent as 'Blue'.

Note that if you have multiple Shopify integrations you can use the 'Copy From' button to copy them over from your other Shopify integration.

Adding a Metafield to a Product

By default, every metafield you've configured is sent to every product. You only need this section if you want a specific product to send fewer metafields than the rest.

If you select any metafields for a product, that product will then send only the metafields you selected — including excluding any metafield you add later. To go back to sending everything, clear the selection so that none are ticked.

Once you've added metafields to your integration, you can select which listings to use them on. You can do this any of three ways (videos below):

  1. Shopify Advanced Options - open a product > Shopify Advanced Options > Manage Shopify Listing > Check off the metafields you'd like to send for this listing.

  2. Import - you'll have a field in your account that looks something like 'Label (Shopify) Metafield Specs' which is the full list of comma-separated metafields for that product. In other words, if you have 'Size' as a metafield and want to add 'Color', you would import 'Size,Color'. Leaving this field blank means "send every metafield", which is the default. Note that this field replaces the whole list rather than adding to it.

  3. Bulk Action - similarly, you could use a Bulk Action to set the same (Shopify) Metafield Specs in bulk.

Here's a video of options 1 and 3:

Setting up Shopify to Display Metafields

If you aren't already using metafields on your Shopify store, or you're using them using a different system or app, you'll want to follow the steps below and also possibly modify your liquid theme code based on how Zentail is communicating your metafields.

Seeing Metafields in the Backend

If you'd like to be able to see metafields on the backend of Shopify (while logged into your myshopify account), you'll need to add a metafields app to your Shopify store. We recommend Metafields guru. No additional action is required! You'll be able to see the metafields (and their values) once pushed from Zentail.

Seeing Metafields on the Frontend

To take these values and display them on the published listing, you'll need to add a snippet of code to your Shopify theme. We recommend following this Shopify Help Article. For our testing, we went to:

Online Store > Themes > Actions > Edit Code > 'product-template.liquid'

And added the snippet below to that file above the section for the description:

{% comment %} Metafields {% endcomment %}
{%- if product.metafields.global != blank -%}
<ul>
{%- for field in variant.metafields.global -%}
<li>{{ field | first }}: {{ field | last }}</li>
{%- endfor -%}
{%- for field in global.metafields.global -%}
<li>{{ field | first }}: {{ field | last }}</li>
{%- endfor -%}
</ul>
{%- endif -%}

Note that all Zentail metafields will be in the global namespace, and all metafields for grouped products will be variant-level. That's why it's important to include both variant.metafields.global and product.metafields.global (for single listings).

Here's the end result of the above code:

FAQs

Can I delete a metafield?

Yes — go to your Shopify integration > Manage Metafields and click the trash can icon.

Two things to know first:

  • Deleting a metafield in Zentail does not remove it from Shopify listings that were already built with it. Those listings keep sending the old value until they are rebuilt. If you need it genuinely removed from Shopify, please contact Zentail Support.

  • If you delete a metafield and later recreate it with the same internal Name, any product that was previously restricted to a specific set of metafields will still be pointing at that name. This is usually what you want, but it does mean the earlier configuration is still in effect.

What if I need to update a metafield spec? Ex: changing 'Color' to 'Shirt Color'

A metafield's settings can't be edited once it's created — including its Source Attribute.

Please contact Zentail Support rather than deleting and recreating it yourself. Deleting a metafield does not remove it from listings that have already been built with it, so the old value keeps being sent to Shopify until something else triggers a full rebuild of those listings. We can make the change for you without that side effect.

If you've already deleted a metafield and are seeing stale or missing values on Shopify, get in touch and we'll clear it up.

Did this answer your question?