App-owned metafields
An app-owned metafield is a metafield that can only be accessed by the app that created it. App-owned metafields can't be overwritten by other apps or by merchants, and can be accessed using GraphQL, similar to private metafields. Unlike private metafields, app-owned metafields can be accessed using Liquid.
Using app-owned metafields, you can provide different levels of features to merchants depending on their app payment plan by using app-owned metafields and conditional app blocks. You can also store API keys and API secrets in app-owned metafields.
Create an app-owned metafield
Anchor link to section titled "Create an app-owned metafield"To create an app-owned metafield, use the metafieldSet
mutation and set the ownerID
to the ID of the AppInstallation
object associated with the app:
POST /admin/api/2022-04/graphql.json
Variables
After you've created an app-owned metafield, you can access its value using the metafield
field on the AppInstallation
object.
Conditional app blocks example: How to use an app-owned metafield to implement a conditional app block.