Translations for Locations (Beta)
The Translations Admin GraphQL API is currently available on Catalyst storefronts only.
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
This query returns a paginated list of translations by resourceType, channel, and locale with a maximum of 50 results per request.
Example mutation: Query a translation
GRAPHQL {{host}}/stores/{{store_hash}}/graphql
X-Auth-Token: {{token}}
query {
store {
translations(filters: {
resourceType: INVENTORY_LOCATIONS,
channelId: "bc/store/channel/1",
localeId: "bc/store/locale/en"
} first: 50) {
edges {
node {
resourceId
fields {
fieldName
original
translation
}
}
cursor
}
}
}
}
Update a translation
This mutation updates a translation.
Example mutation: Update a translation
GRAPHQL {{host}}/stores/{{store_hash}}/graphql
X-Auth-Token: {{token}}
mutation {
translation {
updateTranslations(input: {
resourceType: INVENTORY_LOCATIONS,
channelId: "bc/store/channel/1",
localeId: "bc/store/locale/es",
entities: [
{
resourceId: "bc/store/inventoryLocation/1",
fields: [
{
fieldName: "city",
value: "Ville (OVR) TEST ES"
},
{
fieldName: "state",
value: "État (OVR) TEST ES"
}
]
},
{
resourceId: "bc/store/inventoryLocation/2",
fields: [
{
fieldName: "city",
value: "Ville (OVR) TEST ES"
},
{
fieldName: "state",
value: "État (OVR) TEST ES"
}
]
}
]
}) {
__typename
errors {
__typename
... on Error {
message
}
}
}
}
}
Delete a translation
The following mutation deletes a translation.
Example mutation: Delete a translation
GRAPHQL {{host}}/stores/{{store_hash}}/graphql
X-Auth-Token: {{token}}
mutation {
translation {
deleteTranslations(input: {
resourceType: INVENTORY_LOCATIONS,
channelId: "bc/store/channel/1",
localeId: "bc/store/locale/en",
resources: [
{
resourceId: "bc/store/inventoryLocation/2",
fields: ["city", "state"],
}
]
}) {
__typename
errors {
__typename
... on Error {
message
}
}
}
}
}
Did you find what you were looking for?