Translations for Locations (Beta)

The Translations Admin GraphQL API is available on Catalyst storefronts by default and in early access for Stencil and other headless storefronts. To get early access, reach out to the BigCommerce support team.

The locations translatable fields are:

  • Name
  • Address 1
  • Address 2
  • Description
  • City
  • State (optional)
  • Meta Keywords
  • Name (Special hours)

Examples

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

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
1 GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql
2 X-Auth-Token: {{token}}
3
4 query {
5 store {
6 translations(filters: {
7 resourceType: INVENTORY_LOCATIONS,
8 channelId: "bc/store/channel/1",
9 localeId: "bc/store/locale/en"
10 } first: 50) {
11 edges {
12 node {
13 resourceId
14 fields {
15 fieldName
16 original
17 translation
18 }
19 }
20 cursor
21 }
22 }
23 }
24 }

Query a translation by resourceId

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

This query returns a translation by resourceId.

Example query: Query a translation by resource id
1 GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql
2 X-Auth-Token: {{token}}
3
4 query {
5 store {
6 translations(filters: {
7 resourceType: INVENTORY_LOCATIONS,
8 channelId: "bc/store/channel/2",
9 localeId: "bc/store/locale/it",
10 resourceIds: ["bc/store/inventoryLocation/1", "bc/store/inventoryLocation/2"]
11 }) {
12 edges {
13 node {
14 resourceId
15 fields {
16 fieldName
17 original
18 translation
19 }
20 }
21 cursor
22 }
23 }
24 }
25 }

Update a translation

This mutation updates a translation.

Example mutation: Update a translation
1 GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql
2 X-Auth-Token: {{token}}
3
4 mutation {
5 translation {
6 updateTranslations(input: {
7 resourceType: INVENTORY_LOCATIONS,
8 channelId: "bc/store/channel/1",
9 localeId: "bc/store/locale/es",
10 entities: [
11 {
12 resourceId: "bc/store/inventoryLocation/1",
13 fields: [
14 {
15 fieldName: "city",
16 value: "Ville (OVR) TEST ES"
17 },
18 {
19 fieldName: "state",
20 value: "État (OVR) TEST ES"
21 }
22 ]
23 },
24 {
25 resourceId: "bc/store/inventoryLocation/2",
26 fields: [
27 {
28 fieldName: "city",
29 value: "Ville (OVR) TEST ES"
30 },
31 {
32 fieldName: "state",
33 value: "État (OVR) TEST ES"
34 }
35 ]
36 }
37 ]
38 }) {
39 __typename
40 errors {
41 __typename
42 ... on Error {
43 message
44 }
45 }
46 }
47}
48
49}

Delete a translation

The following mutation deletes a translation.

Example mutation: Delete a translation
1 GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql
2 X-Auth-Token: {{token}}
3
4 mutation {
5 translation {
6 deleteTranslations(input: {
7 resourceType: INVENTORY_LOCATIONS,
8 channelId: "bc/store/channel/1",
9 localeId: "bc/store/locale/en",
10 resources: [
11 {
12 resourceId: "bc/store/inventoryLocation/2",
13 fields: ["city", "state"],
14 }
15 ]
16 }) {
17 __typename
18 errors {
19 __typename
20 ... on Error {
21 message
22 }
23 }
24 }
25}
26}