How to access app owned meta object in theme app extensions's liquid file?

How to access app owned meta object in theme app extensions's liquid file?

mh_rafi
Shopify Partner
2 0 6

My app is creating object definition and also adding object entries using graphql. I followed the doc https://shopify.dev/docs/apps/custom-data/ownership#create-a-metaobject-definition-under-a-reserved-...


The type is here "$app:my_objects" which is automatically resolved to "app--123456--my_objects".

But how can I access object items in theme app extension's liquid file.
shop.metaobjects.my_objects.values does not work in liquid.
shop.metaobjects["$app:my_objects"].values also does not work as $app is not resolving like graphql.

 

Only shop.metaobjects["app--52855472129--my_objects"].values is working. But I think I can not use hard coded type name in liquid file as it will be generated by shopify when the app will make the graphql request.

 

Thanks in advance!

Replies 3 (3)

RiptideApps
Shopify Partner
11 0 7

Bump on this. I'm also searching for a solution. Have you had any such luck? 

mh_rafi
Shopify Partner
2 0 6

I ended up using shop.metaobjects["app--52855472129--my_objects"].values in liquid file, the APP ID(52855472129) is a constant value and remains same for all merchant stores. I guess it's not a standard approach, but couldn't find any solution.

RiptideApps
Shopify Partner
11 0 7

Trying to get more visibility on this issue. I also posted here: https://community.shopify.com/c/metafields-and-custom-data/app-owned-metaobject-access-in-liquid/td-...