Hello everyone,
I’m posting this to highlight a significant friction point for merchants and theme developers trying to build custom storefront experiences using data provided by apps. This specifically relates to accessing app-owned metafields in Liquid.
The Current Problem
When an app creates a metafield definition on a resource (like a product or shop) using a reserved, protected namespace (e.g., $app:my-app-data), the standard Liquid access for a merchant or theme developer is complex and brittle:
-
The simple, merchant-created metafield access looks like this:
Code snippet
{{ product.metafields.my_namespace.my_key.value }} -
The access for an app-owned metafield is often not that simple. Instead of using the short, friendly namespace the app owner defines, we are often forced to use the fully expanded, hard-to-find namespace that includes the App ID, like:
Code snippet
{{ product.metafields.app--12345678910--my_app_data.my_key.value }}
This is not merchant-friendly for a few key reasons:
-
Discovery is difficult: A merchant has no easy way to know their app’s ID (
12345678910). They usually have to dig into the app’s settings, a URL, or the GraphQL API. -
Brittle code: If a merchant changes their app (even for an upgrade or replacement of the same function), the App ID changes, and the Liquid code breaks.
-
Inconsistent Experience: It contrasts sharply with how easy it is to access a merchant-created metafield.
Proposed Solution: A Consistent, Friendly Liquid Object
Could we introduce a new, consistent, and well-documented way for merchants to access app-owned metafields in Liquid using the original, friendly namespace and key?
I propose supporting the following syntax for all resources with app-owned metafields:
Code snippet
{{ object.app_metafields['app-alias:namespace'].key.value }}
Where:
-
objectis the resource (e.g.,product,shop,collection). -
app-aliascould be the app’s handle/name or the unique reserved namespace prefix (e.g.,my-app-data). -
namespace.keyis the developer-defined, friendly key (e.g.,config.setting).
A simpler alternative could be:
Code snippet
{{ object.metafields.app_namespace.key.value }}
…where app_namespace is whatever the app declared, and Shopify’s Liquid layer resolves it automatically to the correct app--ID--namespace.
This change would dramatically improve the developer experience for merchants, simplify theme customization, and make Liquid code more readable and robust against changes in App IDs.
