Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
Hello
"valueType" in MetafieldInput was lost?
https://shopify.dev/api/admin/graphql/reference/metafields/metafieldinput
I can see "valueType" in Google cache of the same page.
https://webcache.googleusercontent.com/search?q=cache:m3CXWtM7DncJ:https://shopify.dev/docs/admin-ap...
What's happen??
Thank you.
Says will depricate in new version of api but I am using 2021-04 and disappeared. I can't see "type' either.
 
Yep, can confirm. valueType has disappeared on MetafieldInput and Metafield objects. REST API docs are being displayed fine with a deprecation of 2021-07. In addition, these deprecation notices are not listed on https://shopify.dev/api/release-notes/2021-07, and they are also not causing warnings in App's API Health.
Moreover, changelog here states the deprecation will only happen in 2021-10: https://shopify.dev/changelog/online-store-2-0-new-metafields-type-system-and-dynamic-sources, but here it states the deprecation is 2021-07: https://shopify.dev/apps/metafields/manage#using-type-vs-value_type
Also, when querying the new type parameter on metafields, it is returning json_string instead of just json (json_string does not exist according to https://shopify.dev/apps/metafields/definitions/types -- it has been replaced by json)
I'm incredibly confused here... these inconsistencies are preventing me from upgrading our app to the 2021-07 API. Shopify, can you please clarify?
Sorry for the confusion! We'll be updating each of those pages that Jake linked to make the situation more clear. Here's what you need to know about this transition:
Thank you for your response.
However, it is not my issue.
My issue is that valueType is removed in older version API references.
https://shopify.dev/api/admin/graphql/reference/metafields/metafieldinput?api%5Bversion%5D=2021-04
Version 2021-04 should have valueType, but I cannot see.
Please check and modify the API references.
Thank you.
Hi Dave,
Thanks for the clarification!
So we can upgrade to 2021-07 without the need of updating value_type to type? Then only when upgrading to 2021-10, we will need to ensure we fully migrated to type? Finally, this change will follow the usual deprecation lifeycle (i.e. that is, we will have 9 months to update our apps to 2021-10 on October 1st 2021)?
What's the difference between json_string and json? Can we use the JSON Liquid filter still on the new json type (e.g. {{product.metafields.foo.bar | json}})?
Thanks!
Hi Jake,
Your description of the deprecation and upgrade process is correct, with one change. We decided to delay the removal of value_type until 2022-01. It's still deprecated in 2021-10.
Going forward you should use json instead of json_string. You can use the json liquid filter on the new json type but you need to add .value: {{ product.metafields.foo.bar.value | json }}
Dave
Hi Dave,
Thanks for confirming that -- I was curious to why I was still able to use value_type on 2021-10 and also to why no API Health Alerts were being flagged on our production app.
After value_type (REST) and valueType (GraphQL) is deprecated, we can still continue to use the deprecated json_string, string, and integer on type, correct? From my understanding, this document here, https://shopify.dev/apps/metafields/manage.md#migrating-from-value_type-to-type, points in this direction but some additional clarification would be great here.
Also, the maximum value length has been published in the docs for string: 5 million chars, integer: 100k chars and json_string: 100k chars. What are the maximum lengths for the new type system? I do not see them here: https://shopify.dev/apps/metafields/definitions/types. Is this something that Shopify can clarify in their docs?
Thanks!
You are correct that you'll still be able to use the old json_string, string, and integer types with the new type field. We do encourage you to migrate to json, single_line_text_field, multi_line_text_field, or number_integer if you can. You'll have a more consistent experience (for example, in Liquid) by using the new types everywhere.
I'll try to find those max value/length restrictions and get them into our docs soon, thanks for pointing that out.
Hi Dave,
Thanks for your reply! A question with Liquid I have:
Using the string type, I can output the string into a Javascript variable as follows:
<script>
const old = {{ shop.metafields.global.foo | json }};
</script>
Using the new multi_line_text_field type, I can output the string into a Javascript variable as follows:
<script>
const new = {{ shop.metafields.global.bar.value | json }};
</script>
Both of these examples yield the exact same output for me. However, is this always the case? In other words, is this the correct way to migrate our Liquid code from string to multi_line_text_field? Is there anything I should be aware of? For example, using the new type field could escape the string -- e.g. Liquid turning the string 'hello into \'hello (a Javascript escape) or &hello into &hello (a HTML escape)?
Thanks!
Thanks @Dave_Pelletier ,
So one more thing:
I did updated to 20-07-01 and had to make type to 'lowercase'. My generated code was giving enum values as uppercase like below:
I just realize in the documentation the value type was lowercase for "json_string". https://shopify.dev/apps/metafields/definitions/types. so I did like below and it was accepted.