Shopify Metafield Basics: Managing and Importing Simplified

- Shopify

shopify metafield

At first glance, Shopify might seem limited in customizing product pages, but that’s not the case. The platform offers metafields, a convenient and intuitive tool to highlight the unique features of each product. Metafields allow you to adapt a standard product page to suit any specific needs, making customization easy. Below, we explore the basics of Shopify metafields – an integral part of the Shopify admin and storefront.

In this article, you’ll discover what a Shopify metafield is and explore the various types of metafields available. Following that, we’ll provide a detailed step-by-step guide on adding metafields to a product page in Shopify. Lastly, we’ll cover how to import metafields into Shopify, ensuring you can seamlessly integrate this powerful feature into your store.

What is Metafield in Shopify?

So, what is a metafield in Shopify, you ask? A metafield is a useful feature that allows you to customize the functionality and appearance of your Shopify store’s product pages.

Shopify metafields let you save specialized information that isn’t standard in the Shopify admin. You can use metafields for two main purposes:

  • Internal tracking
  • Customized information display

Sounds a bit confusing, doesn’t it? Let’s be more specific.

Suppose you sell candles. Different candles have different burn times. While a default product page doesn’t include this information, you can use a metafield to display it.

You can also use Shopify metafields for part numbers, color swatches, downloadable files, and more. The platform lets you add metafields to individual product pages, collections, orders, and other parts of your store, directly from your Shopify admin.

Shopify uses the following parts to define metafields:

  • Namespace and key – the combination of namespace and key is a unique identifier for your metafield. Namespace and key should be separated by a “.”, and can only contain letters, numbers, underscores (_), and hyphens (-). Use a namespace to group similar metafields. E.g., namespace products + the keys expiration_date and rating. The namespace and key combination must be unique.
  • Value – this part characterizes the type and format of information that’s contained in your metafield. E.g., plain text, URL, or integer. Note that each metafield type is associated with specific values.
  • Description – it is an optional component of a Shopify metafield that can help you input the correct values in the admin.
  • Validation – it is another optional parameter used to limit the values that your metafield can contain.

Shopify Metafield Types

Now, let’s look at the different types of Shopify metafields. Each type is suitable for specific situations, as they accept a range of supported values. Below is a table showcasing the most common Shopify metafield types, their supported values, and example use cases:

Metafield Type Description Example
Collection reference Link to an existing collection. Supports linking to one or multiple collections in a metafield list. Can be used in a list. Include a “Complete the look” collection for fashion products on your online storefront.
Color RGB values in #RRGGBB format. Can be used in a list. Store the color of a product and set the product page background to the same color.
Date Date values in ISO 8601 format, without a time zone. Can be used in a list. Use this Shopify metafield type to add product expiration dates, order delivery dates, or customer birth dates.
Date and time Date values in ISO 8601 format and time values in UTC. Can be used in a list. Use it for launch events or product release dates.
Decimal Decimal values in the range of +/-9999999999999.999999999, with up to 13 digits before the decimal and up to 9 digits after. Can be used in a list. Use this Shopify metafield to add a carat weight for jewelry.
Dimension Dimensions in metric or imperial units of measurement. Both whole number and decimal values are supported. Can be used in a list. Use it for box heights or product lengths, such as the length of a scarf.
File reference
  • Images less than 20 MB in JPEG, PNG, WEBP, HEIC, and GIF;
  • Videos less than 1 GB and less than 10 minutes long in MOV and MP4;
  • Other file types less than 20MB.

Can be used in a list.

You can use it to add a PDF file for assembly instructions or a video guide instead.
Integer Integer values in the range of -4,611,686,018,427,387,904 to 4,611,686,018,427,387,903. Can be used in a list. For instance, it can be a page count for books.
JSON Raw JSON data for advanced use cases. Cannot be used in a list. With this Shopify metafield, you can add a table of specifications that has different columns for each product.
Metaobject reference A link to a single or multiple metaobject entries. Can be used in a list. Add and display a custom influencer profile.
Mixed reference References of any type. Developer support is needed. Can be used in a list. Use it for dynamic landing pages.
Money Whole numbers and decimal values are supported. The currency code must match the store currency. Cannot be used in a list. Track product cost details, such as distributor cost or ship-to-warehouse cost.
Multi-line text Plain text with line breaks. Cannot be used in a list. Use it to place shipping notes or return policies on product pages.
Page reference A link to an existing page. Linking to a single or multiple pages in a metafield list is possible. Can be used in a list. Add your policy page or a detailed care guide to product pages.
Product reference Linking to one or multiple products in a metafield list. Can be used in a list. Store and display featured products on product pages or collection pages.
Product variant reference Linking to one product variant. Can be used in a list. Store and display other clothing items in the same color on product pages.
Rating Supports decimal values along a given scale. Can be used in a list. Display an audience score or a star rating for a product.
Rich text Text with line breaks and inline styling.

Can only be connected to theme settings that work with rich text. Cannot be used in a list.

Add long-form stories with styling about your brand or product.
Single line text Plain text with no line breaks. Limit single-line fields to preset choices. Can be used in a list. Use this Shopify metafield to add short notes and announcements to store pages.
True or false A checkbox for selecting whether a condition is true or false. Cannot be used in a list. Add this metafield to let customers select additional services, such as engraving.
URL HTTP, HTTPS, and mailto: URLs. Can be used in a list. Add a link to book reviews or product videos.
Volume Whole numbers and decimal values in metric or imperial units of measurement. Can be used in a list. Specify the volume capacity of a water bottle.
Weight Whole numbers and decimal values in metric or imperial units of measurement. Can be used in a list. Specify the weight of a product or ingredient, for example, grams of sugar.

This table provides a comprehensive overview to help you choose the appropriate metafield type for your needs.

How to Add a Metafield to a Product

Adding metafields to products in Shopify involves three main steps:

  1. Create a metafield in your store admin.
  2. Add it to products.
  3. Display it on product pages.

Let’s say you run a furniture store with products that share parameters like materials, designers, and dimensions. Here’s how you can display these details on your product detail pages:

Create a Metafield

You can prepare a new Shopify metafield in the store admin under Settings -> Custom data as follows:

  1. Proceed to the Metafields section;
    crearte shopify metafields
  2. Select Products;
  3. Click on “Add definition”.
    shopify metafield: add definition
  4. Enter a metafield name (i.e., Material), namespace & key, and description;
    shopify metafield: add definition name and description
  5. Select a Shopify metafiled type (i.e., Single line text);
    shopify metafield: select definition type
  6. Configure other parameters: decide whether it is a one-value definition or a list of values, specify character count, etc.shopify metafield: configure other parameters
  7. Repeat these steps to create as many new metafields as your case requires.

To save time, you can use the “Limit to preset choices” in the Validations section of the metafield definition. Activate the feature and provide the options for this metafield. shopify metafield: limit to preset choices

Now, you won’t need to type these values every time you configure a product in your Shopify admin, selecting them from the drop-down instead.

Add It to a Product

Once you create all the necessary metafields, add them to your products – chairs in our example. Follow these steps to add metafields to a product in Shopify:

  1. Go to your Admin > Products;
    shopify metafield: go to a product screen
  2. Locate a product for which you want to add metafields;
    shopify metafield: select a product
  3. Scroll to see available Shopify metafields;
  4. Specify relevant data for this particular product;
    shopify metafield: configure metafield parameters
  5. Add as many metafields as your product requires.
  6. Repeat these actions for other products.
  7. Click “Save.

Product Page Display

During this final step, you will learn how to display the information from metafields on a product page in Shopify. Follow these steps:

  1. Go to Admin > Online Store > Themes > Customize;
    shopify metafield: go to online store -> themes -> customize
  2. Select Products > Default product in the top-middle template menu;
    shopify metafield: go to collection -> products -> defaulkt products
  3. Add a new block under the Product page;
    shopify metafield: add new block to display metafields
  4. Click on the “burger” icon to add metafields content.
    shopify metafield: add metafield to block

That’s how you can add the metafields, displaying them in any way you like.

Shopify Metafield Import & Export

Let’s see how to import and export metafields to Shopify. You need the Import & Export Tool by Firebear to enable this process. Next, it is possible to import and export Shopify metafields as a part of a Product CSV.

Import

Below, we explain the Shopify metafield format suitable for import, update scenarios, metafield columns, and the actual data transfer procedure.

Column Format

When it comes to the Shopify metafield import, your update file should have columns with the meatafield data that follow this structure:

mf_<namespace>.<metafield key>

Update Scenarios

Next, the following processes are at your service:

  • You can use the import to update metafield values in Shopify;
  • You can use the import to create a product with metafields;
  • You can use the import to clear metafield values. Place metafield values in a quotation mark (“”).
    Note that Shopify cannot delete product metafields in bulk.

Columns & Values

The following table contains examples of Shopify meatafield columns and their values suitable for import:

Content Type Attribute Value Example
Multi-line text mf_custom.test_ml_text Test text
Integer mf_custom.test_int 5
Decimal mf_custom.test_dec 4.0
Product mf_custom.test_entity gid://shopify/Product/7682399010997
File mf_custom.test_file gid://shopify/MediaImage/29058352742581
Date and time mf_custom.test_datetime 2024-03-05T18:00:00Z
Date mf_custom.test_date 2024-03-06
Dimension mf_custom.test_dim {“value”:5.0,”unit”:”MILLIMETERS”}
Weight mf_custom.test_weight {“value”:4.0,”unit”:”GRAMS”}
Volume mf_custom.test_volume {“value”:7.0,”unit”:”MILLILITERS”}
True or false mf_custom.test_bool true
Color mf_custom.test_color #59ca22
Rating mf_custom.test_raiting {“scale_min”:”1.0″,”scale_max”:”10.0″,”value”:”4.0″}
URL mf_custom.test_url https://admin.shopify.com/store/firesync1/products/7682412871861
Money mf_custom.test_money {“amount”:”4.00″,”currency_code”:”EUR”}
JSON mf_custom.test_json {“name”:”John”,”age”:30,”car”:null}
Rich text mf_custom.test_rich_text {“type”:”root”,”children”:[{“type”:”paragraph”,”children”:[{“type”:”text”,”value”:”test”}]}]}
Single line text mf_custom.test_single_line_text Test text
Collection mf_custom.test_collection gid://shopify/Collection/236417155253
Product variant mf_custom.test_product_variant gid://shopify/ProductVariant/43712193462453
Metaobject mf_custom.test_meta_object gid://shopify/Metaobject/56229429429
Page mf_custom.test_page gid://shopify/OnlineStorePage/73557213365

Import Workflow

When your update file is prepared, run a standard product import associated with the Import & Export Tool.

  1. Proceed to Apps -> Firebear Import & Export Tool -> Import;
  2. Hit the”Import” button to create a new import profile for Shopify metafields.
    Shopify metafield import: create new import profile
  3. Now, apply basic configurations to initiate the update:
    – Name your import profile;
    – Choose an entity: Product;
    – Select a file type: CSV, XML, XLSX, or Google Sheets;
    – Choose a file source: file upload, URL upload, FTP transfer, or Google Drive import;
    – Provide a file with Shopify metafield data to import.
    Shopify metafield import: set basic parameters
  4. You don’t need to do anything with your mapping section if your update adheres to the Shopify requirements.
    Shopify metafield import: mapping
  5. Click the “Save” button to save your import profile. Next, click the “Import” button to import metafields to Shopify.

Export

As for the Shopify metafield export, it is also a basic product export workflow associated with the Import & Export Tool. Follow these steps to transfer metafields data from your e-commerce website:

  1. Create a new export profile: go to Shopify Admin -> Apps -> Firebear Import & Export Tool -> Export and click the “Export” button.
  2. Configure basic export parameters:
    Shopify metafield export: general export settings
    – Select an entity: Product;
    – Choose a destination: File, FTP, Google Sheets, or Google Drive;
    – Select a file type: CSV, XLSX, XML, or Google Sheets;
    – Choose a lower bunch size value for low-end servers and a higher value for high-end servers.
  3. Create filters if you don’t want to export all records. transfer only particular products with metafields.
    Shopify metafield export: filters
  4. Use the mapping screen to export only the columns essential for your update. Rename all the default Shopify columns, specifying any new custom names. Unselect the columns that you don’t need.
    Shopify metafield export: mapping
  5. Click the “Save & Close” button to save your Shopify metafield export profile and “Export” to transfer metafields from Shopify immediately.

Conclusion

Understanding metafields in Shopify is a relatively complex task that may take time. Therefore, it is recommended to start with simple items and learn the basics. Once you get a grip, managing and importing them becomes essentially simplified; you can create more complex product pages with lots of metafields.

You will be amazed at how much manual work they can save. As you can see, it is also possible to import metafields to Shopify to reduce any manual interactions in this area. For further information on the Shopify metafield import and export, contact us and read our Import & Export Tool Manual.

Get Our Import Tool for Shopify