My stuff is just text, so I would think a metafield could be used instead of a metaobject. But it’s enough to know that you got your app working using this method.
Topic summary
-
Goal: Pass merchant-entered text from an embedded app’s dashboard to an app block on the cart page.
-
Approaches discussed: Metafields vs. metaobjects. Metaobjects are recommended for apps due to access controls that can restrict data to the app, whereas metafields are simpler but less controlled.
-
Proposed workflow (metaobjects):
- Define a metaobject schema via Admin GraphQL (metaobjectDefinitionCreate).
- Create/update/delete metaobject entries via Admin GraphQL (e.g., metaobjectCreate).
- Render the data in the theme app extension/app block using Liquid’s metaobject access.
-
OP notes the data is plain text and initially considered metafields; agrees metaobjects seem viable based on the guidance.
-
Latest development: OP (using the Node/Express Shopify app template) asks where to place the GraphQL code—likely in the server file (app/web/index.js)—and whether to expose it via an API endpoint (e.g., POST /api/metaobject) using the Shopify GraphQL client with a session. A partial code snippet is provided.
-
Outcome/status: No confirmed implementation answer yet; discussion remains open. Helper offers further assistance if issues arise.