BigCommerce
Store Operations
Catalog and Inventory
GraphQL Admin API
Product SEO information

Product SEO Information

Using the Catalog features of the Admin API, you can set and query product SEO information, for example, page title and meta description.

You can perform the following:

For a full schema, see the GraphQL Admin API reference (opens in a new tab).

Input fields

Setting or removing information requires that you specify ID fields in the input. For more information on how to specify ID fields, see Input fields.

Set product SEO information at the global level

The following example sets global product SEO information for the store, from which channels inherit by default. You can set the title and meta description for the product page.

Example mutation: Set product SEO information globally
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
 
mutation (
  $input: SetProductSeoInformationInput!
) {
  product {
    setProductSeoInformation(input: $input) {
      product {
        id
        seoInformation {
          pageTitle
          metaDescription
        }
      }
    }
  }
}
GraphQL variables
{
  "input": {
    "productId": "bc/store/product/111",
    "data": {
      "pageTitle": "Global page title",
      "metaDescription": "Global meta description"
    }
  }
}

Set product SEO information for a locale

The following example sets product SEO information for the specified storefront channel and locale within the channel. These will override global store information. You can set the title and meta description for the product page.

Example mutation: Set product SEO information for a locale
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
 
mutation (
  $input: SetProductSeoInformationInput!
) {
  product {
    setProductSeoInformation(input: $input) {
      product {
        id
        overridesForLocale (localeContext: { channelId: "bc/store/channel/2", locale: "fr" }) {
          seoInformation {
            pageTitle
            metaDescription
          }
        }
      }
    }
  }
}
GraphQL variables
{                                           
  "input": {                                
    "productId": "bc/store/product/111",    
    "localeContext": {
      "channelId": "bc/store/channel/2",      
      "locale": "fr"
    },                       
    "data": {                               
      "pageTitle": "Page title override FR",
      "metaDescription": "Meta description override FR"
    }                                                       
  }
}

Remove product SEO information for a locale

The following example removes product SEO information for the specified channel and locale.

Omitting the overridesToRemove field from the input removes all overrides for product SEO information from the locale.

Example mutation: Remove product SEO information for a locale
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
 
mutation (
  $input: RemoveProductSeoInformationOverridesInput!
) {
  product {
    removeProductSeoInformationOverrides(input: $input) {
      product {
        id
        overridesForLocale (localeContext: { channelId: "bc/store/channel/2", locale: "fr" }) {
          seoInformation {
            pageTitle
            metaDescription
          }
        }
      }
    }
  }
}
GraphQL variables
{
  "input": {
    "productId": "bc/store/product/111",
    "localeContext": {
      "channelId": "bc/store/channel/2",      
      "locale": "fr"
    },  
    "overridesToRemove": ["PRODUCT_PAGE_TITLE_FIELD"]
  }
}

Query product SEO information

The following example retrieves product SEO information. You can retrieve global information for the store and overrides for the specified channel and locale.

Example query: Get product SEO information
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
 
query {
  store {
    product (id: "bc/store/product/111") {
      id
      seoInformation {
        pageTitle
        metaDescription
      }
      overridesForLocale(localeContext: { channelId: "bc/store/channel/2", locale: "fr" }) {
        seoInformation {
          pageTitle
          metaDescription
        }
      }
    }
  }
}
  • The id field contains the product's global ID that you can retrieve from the Get all products endpoint. For example, a product with a global ID of 111 will have an id of "bc/store/product/111".
  • The channelId field contains the channel's global ID that you can retrieve from the Get all channels endpoint. For example, a channel with a global ID of 2 will have a channelId of "bc/store/channel/2".
Did you find what you were looking for?