Catalog and inventory
GraphQL Admin API
Product store metafields

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:

Remove resource ID

Example mutation: Create a store metafield
   POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
   X-Auth-Token: {{ACCESS_TOKEN}}
   Content-Type: application/json
   Accept: application/json
   
   mutation Metafield($input: CreateMetafieldInput!) {
   metafield {
     createMetafield(input: $input) {
         metafield {
             id
             description
             key
             namespace
             permissionSet
             resourceId
             value
             ownerClientId
         }
     }
 }
}
GraphQL variables
    {
   "input":{
       "namespace": "Warehouse Locations",
       "key": "Location",
       "value": "4HG",
       "permissionSet": "APP_ONLY"
   }
}

Use the Global ID

Example mutation: Create a store metafield
   POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
   X-Auth-Token: {{ACCESS_TOKEN}}
   Content-Type: application/json
   Accept: application/json
   
   mutation Metafield($input: CreateMetafieldInput!) {
   metafield {
     createMetafield(input: $input) {
         metafield {
             id
             description
             key
             namespace
             permissionSet
             resourceId
             value
             ownerClientId
         }
     }
 }
}
GraphQL variables
    {
   "input":{
       "namespace": "Warehouse Locations",
       "key": "Location",
       "value": "4HG",
       "permissionSet": "APP_ONLY",
       "resourceId": "bc/store/store/1001197568"
   }
}
💡

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

Did you find what you were looking for?