Translations
Categories

Translations for Categories (Beta)

The Translations Admin GraphQL API is currently available on Catalyst storefronts only.

The categories translatable fields are:

  • Name
  • Description
  • Page Title
  • Meta Keywords
  • Meta Description
  • Search Keywords

Examples

Below are examples of GraphQL queries and mutations for retrieving and managing translation settings for categories.

Query translations

Query a list of translations

This query returns a paginated list of translations by resourceType, channel and locale with a maximum of 50 results per request.

Example query: Query a list of translations
GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql
X-Auth-Token: {{token}}
 
query {
  store {
    translations(filters: {
        resourceType: CATEGORIES,
        channelId: "bc/store/channel/3",
        localeId: "bc/store/locale/en"
      } first: 50) {
      edges {
        node {
          resourceId
            fields {
              fieldName
              original
              translation
            }
          }
        cursor
      }
    }
  }
}

Query a translation by resourceId

⚠️

When querying a translation by resourceId, you must provide the full resourceId in the format bc/store/category/{category_id}.

This query returns a translation by resourceId.

Example query: Query a translation by id
GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql
X-Auth-Token: {{token}}
 
query {
    store {
        translations(filters: {
            resourceType: CATEGORIES,
            channelId: "bc/store/channel/2",
            localeId: "bc/store/locale/it",
            resourceIds: ["bc/store/category/1", "bc/store/category/2"]
        }) {
            edges {
                node {
                      resourceId
                        fields {
                            fieldName
                            original
                            translation
                        }
                    }
                cursor
            }
        }
    }
}

Update a translation

This mutation updates a translation.

Example mutation: Update a translation
GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql
X-Auth-Token: {{token}}
 
mutation {
  translation {
    updateTranslations(input: {
      resourceType: CATEGORIES,
      channelId: "bc/store/channel/1",
      localeId: "bc/store/locale/en",
      entities: [
        {
          resourceId: "bc/store/category/18",
          fields: [
            {
              fieldName: "name",
              value: "name (OVR)"
            },
            {
              fieldName: "description",
              value: "description (OVR)"
            },
            {
              fieldName: "page_title",
              value: "page_title (OVR)"
            },
            {
              fieldName: "meta_description",
              value: "meta_description (OVR)"
            },
            {
              fieldName: "search_keywords",
              value: "search_keywords (OVR)"
            }
          ]
        }
      ]
    }) {
      __typename
      errors {
        __typename
        ... on Error {
          message
        }
      }
    }
  }
}

Delete a translation

The following mutation deletes a translation.

Example mutation: Delete a translation
GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql
X-Auth-Token: {{token}}
 
mutation {
  translation {
    deleteTranslations(input: {
      resourceType: CATEGORIES,
      channelId: "bc/store/channel/1",
      localeId: "bc/store/locale/en",
      resources: [
        {
          resourceId: "bc/store/category/18",
          fields: ["name", "page_title", "meta_description"]
        }
      ]
    }) {
      __typename
      errors {
        __typename
        ... on Error {
          message
        }
      }
    }
  }
}
Did you find what you were looking for?