Metafields using app-reserved namespace not available in liquid theme files

Metafields using app-reserved namespace not available in liquid theme files

AlexVas
Shopify Partner
6 0 30

We have recently received a Shopify API Health report about our app making deprecated API calls. The calls were deprecated since in the new Shopify API version (2023-10) the app-reserved namespace was required when making metafields mutations and queries.
The problem that we are experiencing is that after updating our metafield mutations and queries to use the app-reserved namespace, and successfully executing them, they were not being set in the variable - shop.metafields in the liquid theme files.

This is the updated query we used for registering the metafields with the app-reserved namespace:

{
"query": "mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) { metafieldsSet(metafields: $metafields) { metafields { key namespace value createdAt updatedAt } userErrors { field message code } } }",
    "variables": {
        "metafields": [
            {
                "key": "text",
                "namespace": "$app:consentbar-text",
                "ownerId": "gid://shopify/Shop/metafield-owner-id-example",
                "type": "single_line_text_field",
                "value": "text"
            }
        ]
    }
}


This is how we are testing if the updated metafield is set in the liquid theme files:

window.consentbar_text = "{{ shop.metafields.app--123456--consentbar-text["text"] }}";
console.log(window.consentbar_text);


Could you please specify if the metafields using the app-reserved namespace are expected to not be set in the theme liquid files? If that is the case, are the metafields using app-reserved namespace expected to be used only by the app itself?

Replies 0 (0)