Use access controls for metafields
You can control who has access to the metafields that you own.
How it works
Anchor link to section titled "How it works"If you create a metafield definition under a namespace that you own, and you don't specify an access setting for it, then the definition will be private to your app. This means that no other apps can read or write the metafield values under that definition, including the admin UI on behalf of the merchant.
If you want merchants to be able to read or edit these values, then you can set admin access to MERCHANT_READ
or MERCHANT_READ_WRITE
.
If you want to allow merchants and other apps to read these values, then you can set admin access to PUBLIC_READ
.
If you want to allow access to the storefront surface area (Liquid templates and the Storefront API), then you can set storefront access to PUBLIC_READ
.
Explicit access grants
Anchor link to section titled "Explicit access grants"If you want to specify individual apps that can read or write these values, then you can use explicit access grants. This is shown in the third example below. Explicit access grants apply to the Admin API only.
The first example shows how to create a definition under a namespace that you own. The merchant will have read-only access using the admin UI, but no other API clients will have access.
The following example shows how to create a definition under a namespace that you own. The merchant will have read-only access in the Shopify admin, and the metafields will be publicly readable in the storefront surface area (Liquid templates and Storefront API).
The following example shows how to create a definition that is private to your app, but you are allowing another app to read the metafields by specifying an explicit access grant.