Start Free Trial
Start Free Trial

How to manage Shopify Metafields?

how-to-manage-shopify-metafields

Metafields are custom fields in Shopify and managing them manually in admin is a complicated task.
Here we will take a look at how to bulk manage your Shopify Metafields with Matrixify.

With this tutorial, you can bulk import and export Shopify Metafields that are both defined and without definitions.

Steps in short:

  1. Set up Metafield definitions in your store.
  2. Set Metafield values for one item that you will export.
  3. Create Matrixify app export with Basic Columns with Metafields.
  4. Edit Metafield column values.
  5. Save and import.
  6. Check your updated Metafields.

1. Set up Metafield definitions in your store

First, we need to make sure to set up Metafield definitions in your Shopify store.
They are what limits what values Metafield can have and help you to integrate Metafields in your store’s theme.
You can set them up in your Shopify store admin -> Settings -> Metafields. See Shopify manual on how to create and set up Metafield definitions.

The process works for all entities that Shopify allows to create definitions for, you would just change what entity you are exporting when you create an export in the app.

For a test and example, we are going with the most popular Metafields – Products.
I have created a few Metafield definitions that I will need updating:

1 - set up Shopify Metafield definitions

2. Set Metafield values for one item that you will export

When the app is exporting data from the Shopify store, it will ask for Metafields from each exported item. So first we need to ensure that at least one of the exported Products has these Metafields applied to it for them you show up in the exported file.
Open any Product that you will export later and at the bottom of the item page you can see its metafields and apply values to it.

2 - set up Shopify metafield values in bulk

3. Export Shopify Metafields to a spreadsheet

Now we can go into Matrixify app and create an export to a spreadsheet file where we will bulk update Metafields for other products.

In the app create new export, select export format Matrixify: Excel and select to export Products.
As we only need to update Metafields then we do not need to select to export all data, so under Products open Advanced tab and select to export fields ID, Handle and Metafields.
It should look like this:

3 - export Shopify metafields in bulk Matrixify csv excel xlsx

If you are updating other Metafields then you need to select different data:

  • Variant Metafields – select Products with ID, Handle, Variant ID, Variant Metafields.
  • Collection Metafields – select Smart Collections or Custom Collecitons (depending on which ones you are working with) with ID, Handle and Metafields.
  • Customer Metafields – select Customers with ID, Email and Metafields
  • Order Metafields – select Orders with  ID, Name and Metafields

You do not need to select any other checkboxes. Default export setup will work fine here.

Click the Export button to start the export and download file when finished.

3.1 - export Shopify metafields in bulk Matrixify csv excel xlsx

4. Edit Metafield column values

In your exported file, you can see Metafield:  columns for your Metafield definitions and values for the one product which were applied in previous step:

4 - export Shopify metafields in bulk Matrixify csv excel xlsx

App will export any Metafield that is set for at least one of the exported products. This includes also metafields that do not have definitions set up.

Metafield column is constructed in the following template Metafield: namespace.key [type]
In Metafield definitions, you can also see namespace.key and the Metafield type. Correct Metafield type values to use in column headers you can see in our Metafields documentation.

4.1 - find Shopify metafield namespace key and type csv xlsx excel

You can also use the exported Metafield column headers in your other import files to import those Metafield values.

Now we can actually update values for those Metafield definitions.
It is important to list the value in the same structure as it was exported/example provided in our documentation for each type.
So if the dimension type value is JSON {"value":54.0,"unit":"m"} then you need to apply it the same for other products.

Here I have filled values for other products too:

4.2 - bulk udpate Shopify Metafield values csv excel XLSX importexport

5. Save and import

Now that the file is ready. You can save it and head back into the app.

In the Matrixify app home page Import section upload your edited saved file.
First, the app will analyze the data. Make sure that it shows the correct entity (Products, Customers, etc.) and that the item count is correct.
If all looks correct, then you can click the Import  button to start the import. See our how it works page to learn more about how the import process works.

5 - import bulk update Shopify Metafields Excelify Matrixify CSV Excel XLSX

6. Check your updated Metafields

Once your import has finished, you can check and enjoy your updated Metafield values!

6 - enjoy bulk updated Shopify Metafields import csv excel xlsx Matrixify

 


Displaying Metafields

Metafields are custom fields that you can use in various places, for example, if you need to store some custom information that you will use in your exported reports, but one of main metafield usage is to display this custom stored information in your store, so we will now take a quick look on how to achieve this.

Option 1: Configure your Theme to Show Metafields

Follow Shopify manuals here on how to set up Metafields in your theme. 

Option 2: Edit Theme code yourself

1. Go to your Themes code in your Shopify Admin.

You can locate your themes code going in your Shopify Admin -> Online Store -> Themes -> Actions -> Edit Code

Edit themes code in Shopify

2. Locate product.liquid

“product.liquid” file contains the code for the page that displays your products.

Liquid product Code file

3. Add code to display your Metafield

Now we will add just one line of code to display this new Metafields we created in the ‘Create Metafield’ section.

Material: {{ product.metafields.specs.material }}

If you have stored your Metafield as Variant Metafield then the code you need to add will be different.

Material: {{ current_variant.metafields.specs.material}}

 

Shopify liquid code Metafield

4. Save and go check any product in your store.

Custom text in storepage

Edit your theme code only if you have coding experience.
If you need help with editing your theme code, then you can hire a Shopify expert from the Shopify Experts Marketplace.

Good to know!

  • More detailed information about displaying metafields you can find in Shopify tutorial about Metafield object.
  • Products that have specific Metafield value empty in export does not have this Metafield at all.
  • More detailed information about metafield columns you can find in metafields documentation.
  • If you need to fill Metafield columns in all exported file rows if one item has multiple rows then ask our support!