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:
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.key“.
If there is no namespace defined, then the global namespace is used.
You can have 250 Metafields per item – just add them as additional columns.
If there is a dot already in Metafields namespace or key then in the exported and import files it is escaped with a backslash.
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).
- boolean (values
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
[boolean] at the end.
So the column name would be:
– for integer:
Metafield: somenamespace.somekey [integer]
– for string:
Metafield: somenamespace.somekey [string]
– for JSON string:
Metafield: somenamespace.somekey [json_string]
– for boolean:
Metafield: somenamespace.somekey [boolean]
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).
To delete Metafields, just set all values to empty, and import it.
|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.
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.
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
|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
Good To Know
- To update existing Metafields or add new, minimum required columns are:
- 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?