We’re excited to announce that we’ve just rolled out the ability to attach metadata to a shop’s resources using the Shopify API. This means Shopify app developers can now store additional information about products, collections, orders, blogs, pages… and the shop itself. We’re calling this feature metafields.
For the time being, you can only add these metafields and edit them using the Shopify API. Some time from now, we will make it possible for a shop owner to manage them from the admin interface.
The ability to use metafields in a Shopify theme has already been implemented. So you can output and use metafields in your Liquid templates (including email templates), provided you’ve added them using the API.
Our API documentation has been updated to show you how to add, edit and delete metafields. Check out the API Documentation page on MetaFields.
A metafield consists of a namespace, a key, a value, and a description (optional). Use the namespace to group different metafields in a logical way. You can also specify that it is either an integer or a piece of text (a “string”). In this way, you’ll end up with the right type when you use it in your Liquid.
Say you’ve added to a product a metafield with the following attributes:
- description: Author of book
- namespace: book
- key: author
- value: Kurt Vonnegut
- value_type: string
You can output the value of this metafield in product.liquid with this Liquid tag:
{{ product.metafields.book.author }}
There is currently no limit imposed on how many metafields you can attach to any piece of content.
If you’re a Ruby on Rails developer, our shopify_api gem will get you started with adding metafields. Take a look at the Metafields module defined in shopify_api.rb.
Using the Metafields module, setting a metafield on a product is as easy as this:
product = ShopifyAPI::Product.find(product_id)
product.add_metafield(ShopifyAPI::Metafield.new({
:description => 'Author of book',
:namespace => 'book',
:key => 'author',
:value => 'Kurt Vonnegut',
:value_type => 'string'
}))
Metafields can be used to further describe products, beyond the product description, type, vendor and tags. You can also use metafields to store a ‘teaser’ or ‘summary’ for a blog post.
App Store developers can also use metafields to share information between multiple applications.
The possibilities are limitless. We’re inviting you to share your ideas on how to use metafields with the rest of the Shopify’s community in our Community forums.
Update: Metafields can now be added to product variants as well.
Are these meta fields exported with products csv?
Jamie: metafields are not exported with the products CSV.
Anders: there are still a few gaps which keep it from being a perfect solution, but we encourage people to experiment along these lines.
Is metafields the way to create a multilingual shop?
Can these Metafields be added at the variant level?
Thanks in advance.
Hi Alex,
I doubt very much that Metafields will make it to the admin screens on time for the holidays, Christmas being next week. It’s easy (enough) though to write a Shopify app to set those for your shop. You can already read the metafields using Liquid in your theme.
Anders,
You asked: “are metafields the way to create a multilingual shop?”
Metafields are a step in the right direction I think. You can add translations for all of your content (blog posts, product titles and descriptions, etc.) However, you will still need JavaScript to hide/reveal the bits and pieces that are in the ‘right’ language, add a language-switcher to your theme and store the picked language in a web cookie… you will have to take care of all this and more… You will need to translate your navigation items and your UI… Also, take note that checkout is still in only one language, that you get to pick of course, but you can’t translate the language used on checkout pages ‘on the fly’…
Jamie,
Hi there! :-)
[EDIT] You can store your UI and navigation translations as shop’s metafields. I forgot that. The shop itself can have metafields attached to it.
Great news. Is there an ETA for the admin interface? We’re developing a site over the holidays that would really benefit from this.
Hi Alex, metafields can only be attached to these pieces of content:
Order
Product
Custom Collection
Smart Collection
Page
Blog
Blog Article
Shop
So, no, you can’t add these to a variant.
I hate to nag, but is there any ETA on when this will be available in the admin screen? I’d prefer to not have to learn Ruby just to hack together a way of submitting data.
Metafields sound awesome – can’t wait to be able to use them :)
Actually, leaving out product variant metafields was an oversight. We added them to the system yesterday, so they are now indeed available.
Love it, haven’t tried them yet but I’m dying to find time :-) Will the metafields ever be exported with the product information or is there a reason we can’t do that?
Nearly 18 months since the last post on this, and still no Meta Fields in Shopify by default. In this modern day and age of SEO, this is absolutely critical!
How’s a guy supposed to win $100K if he doesn’t have easy access to SEO?
Any ideas on on ETA?
Hi, what is the max length in the value string?
Is there any way to mass edit metafields? For example a mass CSV import and export. This feature would make my life so much easier!
@Will Law we are considering developing an app for this kind of stuff. wondering how many people would like to see this happening?
I love this apps!
It’s realy helpfull for me to add more additional info for the product.
Metafields are great, but for some reason they are not copying when I duplicate a product. Is this a Metafields feature limitation, or an issue with the way it’s been implemented on my store? Thanks!
I’m looking to move a client’s online store over to Shopify, but the lack of ability for the client to add things like ‘meta description’ and an SEO title etc seems pretty basic and flawed.
Is this any closer to being integrated?