Shopify Tip: How to Add Metafields to Products and Variants Without Using an App
Shopify has supported Metafields for a long time now but there was no option to manage them directly via the Shopify Admin so merchants often had to use third-party apps to add/update metafields.
A recent update takes care of this where Shopify merchants can now manage metafields directly from the Shopify Admin wihout the need of an app or writing custom code to interact with the API.
Metafields allow merchants to attach additional attributes to resources such as products, variants, and customers. Those additional attributes can then be displayed on Shopify pages. They can also be used when generating product feeds for other platforms such as Google Shopping, where the other platform may require the merchant to include additional product attributes in the data feed export.
Currently, only product and variant metafields are supported but additional support for collections, customers, and orders appears to be coming soon.
In this article, we'll go over how we can add metafields to products.
1. In the Shopify Admin, go to Settings > Metafields.
2. Add a Metafield Definition for Products.
In the above example, we added a metafield called "Perishable" which accepts a True or False value.
Also note that on the top right corner of the screen, there's an option to "Pin" the metafield definition. This option basically just shows/hides the metafield by default on resource pages (see below). This is especially useful if you plan to add a lot of metafields but most of them are rarely used. You can use this option to only pin the most used metafields for quicker editing.
3. Go to the Products page and select a product to edit.
When viewing the product details, scroll down towards the bottom and you should now see a separate section called "Metafields" where you can see the metafield definition we've added.
You can then specify the desired values and save it.
I really like how Shopify now provides so many field types as well as this helps keep the data more consistent. In the past, the metafields only supported either string/text or integer data types.
I hope this article proves useful. Currently, it's not possible to expor the metafields directly via the Shopify Admin but an app like EZ Exporter can help with exporting the metafields data along with other standard product data.