Metafields for Import and Export
Metafields can be exported to Excel and CSV format.
Shopify Metafields are available as additional columns in the following Excel sheets or CSV files:
Column Names
Each new column represents specific Metafield – its Column name starts with “Metafield: “, and whatever follows after that, is the metafield name saved in Shopify.
To specify a Metafield namespace, include it in the name, and split with a dot (.). For example: “Metafield: namespace.fieldname“.
If there is no namespace defined, then the global namespace is used.
You can have unlimited Metafields – just add them as additional columns.
Metafield Types
Each Metafield for each item can have one of the types:
- integer (whole number)
- string (text)
- json_string (string in the JSON format which gets automatically converted to Object in the Liquid theme code).
When exporting Metafields – those types will be reflected as Excel cell value types. If the value is an integer type, then in the Excel cell that will also be visible as an integer. And if that’s a text, then, of course, it will also be visible as a text type, even if it will contain a numeric value.
The same applies to import. If you need to import number as “integer” type, then set the Excel cell type to number. And the app will automatically detect that.
Note that each row for the same Metafield column can have a different type.
If you really want to force the field type, regardless of the Excel column type, you can specify the type in the column name by putting “[integer]”, “[string]” or “[json_string]” at the end.
So the column name for integer would be like that: “Metafield: somenamespace.somename [integer]”. Or for string: “Metafield: somenamespace.somename [string]”. Or for JSON string: “Metafield: somenamespace.somename [json_string]”.
Cell Values
Each row cell is a Metafield value of that respective Metafield column.
In Shopify – Metafields are actually not columns, they are entries for each separate item. There can be some items with Metafields, and some without.
If the exported Metafield value is empty, then it means that this Metafield is either empty for that row, or it doesn’t exist.
When the Metafield is imported, if there is some value, then it will either create or update the existing Metafield in Shopify. If the value is empty, then this Metafield for that item will be deleted (not set to empty value, but deleted).
Deleting Metafields
To delete Metafields, just set all values to empty, and import it.
Metafield Examples
Column Name | Description |
---|---|
Metafield: title_tag | SEO Title
If the value will match exactly the same Product (or Collection) Title, then Shopify stores it as an empty value. Also, if the value is empty, then Shopify will serve SEO Title the same as Product (or Collection) Title. Therefore – SEO Title is never empty. When exporting, you will have some value only if it differs from the Product (or Collection) Title. Text Mom Strength Red T-shirt Slim Fit |
Metafield: description_tag | SEO Description
If the value will match exactly the same Product Description, then Shopify stores it as an empty value. Also, if the value is empty, then Shopify will serve SEO Description the same as Product Description. Therefore – SEO Description is never empty if Product has some description at all. When exporting, you will have some value only if it differs from the Product (or Collection) Description. Text Those t-shirts are the best ones for smart moms. |
Metafield: some number | If you set the value in Excel as a number, it will be automatically saved as “integer” type.
Text or Number 234876234 |
Metafield: namespace.name | If column name starts with “Metafield: “, then what comes next is treated as Metafield name. To set the namespace, prefix it before the name, and “.” (dot). If a namespace is not set, then it will be set to “global”.
If column name has “[string]” or “[integer]” at the end, then it will force the type accordingly from that. If the Metafield value is empty, then it will not be updated at all – this item Metafield will be ignored. Text or Number Anything can be written here. |
Metafield: birthday | If you want to save Customer birthdate, and use it in the Store.
Text or Number 1980-11-18 |
Good To Know
- To update existing Metafields or add new, minimum required columns are:
- ID
- Handle (if you want it to identify item by Handle)
- Metafield: ****
- The easiest way to learn Metafields is to export them and watch how they are in Excel. Then import them back, and see what changed. You can do those experiments with just one row.
- In Shopify, there is a limit of 250 Metafield values per item.
- See more about Metafields – what they are, and why there exist, in this tutorial: How to manage Shopify Metafields?