Store Metafields

Store metafields allow you to attach a metafield to the store itself. They are suitable for any global information against the store that is not channel specific. Channel metafields are appropriate for any storefront-specific data you need to store in metafields. There are two ways to create a store metafield in Admin GraphQL. You can remove the resource ID or use the store’s Global ID. Examples of each type are below:

You can create 10,000 metafields on a store entity instead of the typical limit of 250 per entity-per-client-id.

Remove resource ID

Example mutation: Create a store metafield
1 POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
2 X-Auth-Token: {{ACCESS_TOKEN}}
3 Content-Type: application/json
4 Accept: application/json
5
6 mutation Metafield($input: CreateMetafieldInput!) {
7 metafield {
8 createMetafield(input: $input) {
9 metafield {
10 id
11 description
12 key
13 namespace
14 permissionSet
15 resourceId
16 value
17 ownerClientId
18 }
19 }
20 }
21}
GraphQL variables
{
"input":{
"namespace": "Warehouse Locations",
"key": "Location",
"value": "4HG",
"permissionSet": "APP_ONLY"
}
}

Use the Global ID

Example mutation: Create a store metafield
1 POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
2 X-Auth-Token: {{ACCESS_TOKEN}}
3 Content-Type: application/json
4 Accept: application/json
5
6 mutation Metafield($input: CreateMetafieldInput!) {
7 metafield {
8 createMetafield(input: $input) {
9 metafield {
10 id
11 description
12 key
13 namespace
14 permissionSet
15 resourceId
16 value
17 ownerClientId
18 }
19 }
20 }
21}
GraphQL variables
{
"input":{
"namespace": "Warehouse Locations",
"key": "Location",
"value": "4HG",
"permissionSet": "APP_ONLY",
"resourceId": "bc/store/store/1001197568"
}
}