All Collections
Shopify
How to use Shopify Metafields with Zentail
How to use Shopify Metafields with Zentail

How to send item attributes to Shopify

Ziggy avatar
Written by Ziggy
Updated over a week ago

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

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 of 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'.

  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, by going to your Shopify integration > Manage Metafields and clicking the trash can icon. Note: deleting and recreating a field with the same internal name will keep those settings and be sent on products where the field was used before.

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

Once created, a metafield can't be updated. However, you could export product using that metafield, delete the metafield, recreate it, then import those products again to reapply it.

Did this answer your question?