How do I use CSV Import to update metafields? •
The metafields
object allows you to store additional information for products, variants, collections, customers, orders, blogs, pages and your shop.
Bulk Product Edit supports bulk adding/editing/deleting metafields related to products, variants, collections, customers, and orders.
A metafield consists of a namespace, a key, a value, and a value type. Use the namespace to group different metafields together in a logical way.
How to update metafields through CSV import
1. Let the app know which column contains the values for the metafield you are going to update.
2. Let the app know the namespace and key of the metafield you are going edit.
For example:
namespace: custom
key: color
will be in this format:
3. By default, value type will be "Single Line Text." If you need to set value type to a different type such as "Integer" or "Multi Line Text", please select the required type from our metafield type dropdown menu
For example:
namespace: custom
key: color
type: Single Line Text
Supported value types are:
'multi_line_text_field', 'single_line_text_field', 'product_reference','variant_reference', 'collection_reference', 'page_reference', 'file_reference', 'metaobject_reference', 'mixed_reference', 'url', 'link, 'number_integer', 'number_decimal', 'date', 'date_time', 'json','boolean', 'color', 'weight', 'volume', 'dimension', 'rating', 'money', 'rich_text_field'
You can also update metafields of supported list value types as listed below:
'list.collection_reference', 'list.color', 'list.date', 'list.date_time', 'list.dimension', 'list.file_reference', 'list.link', 'list.metaobject_reference', 'list.mixed_reference', 'list.number_integer', 'list.number_decimal', 'list.page_reference', 'list.product_reference', 'list.rating', 'list.single_line_text_field', 'list.url', 'list.variant_reference', 'list.volume', 'list.weight'
You can learn more about value types here: Shopify Metafield Types
How to update list type metafields
For list type metafields, the value in the CSV must be in a JSON array. If the value is not in this format, the change will be rejected by Shopify. You can find a sample JSON array provided by Shopify in the screenshot below:
How to update rich text metafields
Rich text metafields will only accept a JSON object that has the following general structure:
{ "type": "root", // The root holds an array of paragraphs and lists. Each paragraph represents a section of text that's separated by a line break. "children": [ { "type": "paragraph", // A paragraph holds an array of formatted text objects and URL objects, where the objects are concatenated to form the text within the paragraph. "children": [ // Formatted text object { "type": "text", "value": "This is italicized text and ", "italic": true }, // URL object { "url": "https://example.com", "title": "Link to example.com", "type": "link", "children": [ // Formatted text object that's embedded in the URL object. { "type": "text", "value": "a bolded hyperlink", "bold": true } ] } ] } ] }
You can learn more details and examples on rich text metafield formatting here: Rich Text Formatting
How to delete metafields through CSV import
If the value in the CSV column is "delete", the metafield will be deleted.