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 a client ID or client secret in app-owned metafields.
This guide shows you how to create an app-owned metafield using the GraphQL Admin API.
RequirementsAnchor link to section titled "Requirements"
Your app can make authenticated requests to the GraphQL Admin API.
You have access to the type of resource that you want to add the metafield on. For example, setting a metafield on a
PRODUCTrequires the same access as mutating a product.
Create an app-owned metafieldAnchor link to section titled "Create an app-owned metafield"
After you've created an app-owned metafield, you can access its value using the
metafield field on the
- Use an app-owned metafield to implement a conditional app block.