I am having trouble finding the liquid app object. Shopify mentions about this object here https://shopify.dev/changelog/new-app-liquid-object but when we click the link within it(https://shopify.dev/api/liquid/objects#app) to go to the object nothing appears. I am trying to access App-owned metafields in the theme app extension liquid file. Even if I mention app object in the liquid file it throws an error(Undefined object "app"). Can somebody please let me know how I can access App owned metafields in Theme Extension?
2
Answers
You can find more info on app owned meta fields here
App-owned metafields
The ‘new-app-liquid-object’ you mention was only added this year in April 2022, so my first thought is to check the Shopify API version that’s currently in use incase it’s earlier than than April 2022 and hence the feature doesn’t exist yet. This seems like the most likley issue.
The method
.metafields
can be queried on a number of different object types, so the following should all work:product.metafields
,customer.metafields
,order.metafields
and yesapp.metafields
as well. (In the metafield docs click ‘map’ on the example code to the right see what I mean)From their example you’d access the value of an item like this:
product.metafields.information.pickup_locations.value.last
As the announcement says "A new Liquid app object is available for use within the context of theme app extensions and app proxies. " [emphasis added]
Which "app" are you trying to access?
Actually can you give a more tangible example of what you are trying to do?