What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Can I access App-data metafields in the App Embed Blocks?

Solved

Can I access App-data metafields in the App Embed Blocks?

JuanVan
Shopify Partner
3 1 1

Hi, I am using App Embed Blocks, and I want to embed some dynamic content in them.

Can I store values through App-data metafields and then access them in the block?

For example:

 

<div style="position: fixed; bottom: 0; right: 0">
    {{ app.metafields.namespace_test.key_test }}
</div>
{% schema %}
  {
    "name": "App Embed",
    "target": "body",
    "settings": []
  }
{% endschema %}

 

I have created a metafield for the app using Admin GraphQL according to this example document. After testing, I actually got an empty string. If I can’t access `app.metafields` within the blocks, is there any other way to access the custom variables of the application?

I would be grateful for a response.

Accepted Solution (1)

JuanVan
Shopify Partner
3 1 1

This is an accepted solution.

The problem has been solved. The cause of the issue was an incorrect accessToken, which belonged to another App.

View solution in original post

Reply 1 (1)

JuanVan
Shopify Partner
3 1 1

This is an accepted solution.

The problem has been solved. The cause of the issue was an incorrect accessToken, which belonged to another App.