value_type and type expected behavior and difference for metafields endpoints in Rest API

8 0 2

As per the recent changelogs (, Shopify deprecated the "value_type" field and replaced it with the "type" field. 



  1. When we create a metafield with "value_type" as "string" it is populating "type" also with "string" value. As per the list supported fields for "type"(, there is no "string" type and it is rather "single_line_text_field", "multi_line_text_field" etc. Also, is it valid that "type" is also accepting values like string, integer while creating metafields? Is there any reason why the type field is accepting values other than the list of values supported?
  2. Once "value_type" is completely retired, is there any migration carried from the Shopify side to change the "type" field values to any of the list of supported fields here --> or will they still be "integer", "string" etc., 


Reply 1 (1)

Shopify Staff
20 4 12

Good questions!

For compatibility purposes, the new "type" attribute does accept deprecated value types as well. This was done to make the API migration less of a breaking change. Otherwise, when API clients moved from the "value_type" field to "type", they would have also had to change their types would easily could have broken other integrations (such as Liquid in themes). This way, it's fairly easy to update the field name while keeping the rest the same.

However, since metafield definitions are brand new, they only support the new type system. It's up to our merchants and partners to adopt them at their own pace but we do encourage it because of all the benefits they bring.

Note: while we might refer to these existing value types as "deprecated", they aren't going away anytime soon. We can't just change the underlying type of a metafield since it would be a breaking change. So to answer your last question, when the value_type fields are completely removed from our APIs, the "type" value will still remain the same.

I think our docs could probably be improved to explain this situation better, so we'll review them.

To learn more visit the Shopify Help Center or the Community Blog.