diff --git a/docs/store-operations/translations/index.mdx b/docs/store-operations/translations/index.mdx index e71378314..5269d4259 100644 --- a/docs/store-operations/translations/index.mdx +++ b/docs/store-operations/translations/index.mdx @@ -16,6 +16,8 @@ The API currently supports translations for the following resource types, and mo * Brands * [Product Filters](/docs/store-operations/translations/filters) * [Locations](/docs/store-operations/translations/locations) +* [Shipping Methods](/docs/store-operations/translations/shipping-methods) +* [Tax Rates](/docs/store-operations/translations/tax-rates) Refer to the [Error Handling](/docs/store-operations/translations/errors) guide for understanding and handling errors while managing translations. @@ -74,4 +76,6 @@ For more information on OAuth Scopes, see our [Guide to API Accounts](/docs/star - [Product Listing Page Translations](/docs/store-operations/translations/listings) - [Product Filter Translations](/docs/store-operations/translations/filters) - [Inventory Locations Translations](/docs/store-operations/translations/locations) +- [Shipping Methods Translations](/docs/store-operations/translations/shipping-methods) +- [Tax Rates Translations](/docs/store-operations/translations/tax-rates) - [Error Handling Reference](/docs/store-operations/translations/errors) diff --git a/docs/store-operations/translations/shipping-methods.mdx b/docs/store-operations/translations/shipping-methods.mdx new file mode 100644 index 000000000..0d5dc1b04 --- /dev/null +++ b/docs/store-operations/translations/shipping-methods.mdx @@ -0,0 +1,291 @@ +# Translations for Shipping Methods (Beta) + + + The Translations Admin GraphQL API is currently available on Catalyst + storefronts only. + + +The following entities are translatable for shipping methods: + +- Shipping Method Name as `shipping_method_name` + +## Resource fields + +| Entity Type | `resourceType` | `resourceId` Format | +| ------------------ | ------------------ | ---------------------------------------- | +| Shipping Method | `SHIPPING_METHODS` | `bc/store/shippingMethod/{id}` | + +## Examples + +Below are examples of GraphQL queries and mutations for retrieving and managing translation settings for shipping methods. + +### Query a List of Translations + +This query returns shipping method translations for the specified resource type, channel, and locale (up to 50). + + + + +```graphql filename="Example query: Query a list of translations" showLineNumbers copy +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql +X-Auth-Token: {{token}} + +query { + store { + translations(filters: { + resourceType: SHIPPING_METHODS, + channelId: "bc/store/channel/{{channel_id}}", + localeId: "bc/store/locale/{{locale_code}}" + }) { + edges { + node { + resourceId + fields { + fieldName + original + translation + } + } + cursor + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } + } +} +``` + + + + +```json filename="Example query: Query a list of translations" showLineNumbers copy +{ + "data": { + "store": { + "translations": { + "edges": [ + { + "node": { + "resourceId": "bc/store/shippingMethod/1", + "fields": [ + { + "fieldName": "shipping_method_name", + "original": "Dev Test 1", + "translation": "espanol" + } + ] + }, + "cursor": "" + } + ], + "pageInfo": { + "hasNextPage": false, + "hasPreviousPage": false, + "startCursor": "eyJyZXNvdXJjZUlkIjoxfQ", + "endCursor": "eyJyZXNvdXJjZUlkIjoxfQ" + } + } + } + } +} +``` + + + + +### Query a Translation by Resource ID + +This query returns a translation by `resourceId`. + + +When querying by `resourceId`, provide the full ID in the format `bc/store/shippingMethod/{id}`. + + + + + +```graphql filename="Example query: Query a translation by id" showLineNumbers copy +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql +X-Auth-Token: {{token}} + +query { + store { + translations( + filters: { + resourceType: SHIPPING_METHODS + channelId: "bc/store/channel/{{channel_id}}" + localeId: "bc/store/locale/{{locale_code}}" + resourceIds: ["bc/store/shippingMethod/1"] + } + ) { + edges { + node { + resourceId + fields { + fieldName + original + translation + } + } + cursor + } + } + } +} +``` + + + + +```json filename="Example query: Query a translation by id" showLineNumbers copy +{ + "data": { + "store": { + "translations": { + "edges": [ + { + "node": { + "resourceId": "bc/store/shippingMethod/1", + "fields": [ + { + "fieldName": "shipping_method_name", + "original": "Dev Test 1", + "translation": "espanol" + } + ] + }, + "cursor": "" + } + ] + } + } + } +} +``` + + + + +### Update a Translation + + + + +```graphql filename="Example mutation: Update a translation" showLineNumbers copy +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql +X-Auth-Token: {{token}} + +mutation { + translation { + updateTranslations(input: { + resourceType: SHIPPING_METHODS, + channelId: "bc/store/channel/{{channel_id}}", + localeId: "bc/store/locale/{{locale_code}}", + entities: [ + { + resourceId: "bc/store/shippingMethod/1", + fields: [ + { + fieldName: "shipping_method_name", + value: "Nuevo Nombre de Envío" + } + ] + } + ] + }) { + errors { + __typename + ... on Error { + message + } + ... on EntityNotFoundError { + message + } + ... on ValidationError { + message + } + } + } + } +} +``` + + + + +```json filename="Example mutation: Update a translation" showLineNumbers copy +{ + "data": { + "translation": { + "updateTranslations": { + "errors": [] + } + } + } +} +``` + + + + +### Delete a Translation + + + + +```graphql filename="Example mutation: Delete a translation" showLineNumbers copy +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql +X-Auth-Token: {{token}} + +mutation { + translation { + deleteTranslations(input: { + resourceType: SHIPPING_METHODS, + channelId: "bc/store/channel/{{channel_id}}", + localeId: "bc/store/locale/{{locale_code}}", + resources: [ + { + resourceId: "bc/store/shippingMethod/1", + fields: ["shipping_method_name"] + } + ] + }) { + errors { + __typename + ... on Error { + message + } + ... on EntityNotFoundError { + message + } + ... on ValidationError { + message + } + } + } + } +} +``` + + + + +```json filename="Example mutation: Delete a translation" showLineNumbers copy +{ + "data": { + "translation": { + "deleteTranslations": { + "errors": [] + } + } + } +} +``` + + + + diff --git a/docs/store-operations/translations/tax-rates.mdx b/docs/store-operations/translations/tax-rates.mdx new file mode 100644 index 000000000..fa83af082 --- /dev/null +++ b/docs/store-operations/translations/tax-rates.mdx @@ -0,0 +1,291 @@ +# Translations for Tax Rates (Beta) + + + The Translations Admin GraphQL API is currently available on Catalyst + storefronts only. + + +The following entities are translatable for tax rates: + +- Tax Rate Name as `tax_rate_name` + +## Resource fields + +| Entity Type | `resourceType` | `resourceId` Format | +| ----------- | -------------- | ----------------------------- | +| Tax Rate | `TAX_RATES` | `bc/store/taxRate/{id}` | + +## Examples + +Below are examples of GraphQL queries and mutations for retrieving and managing translation settings for tax rates. + +### Query a List of Translations + +This query returns tax rate translations for the specified resource type, channel, and locale (up to 50). + + + + +```graphql filename="Example query: Query a list of translations" showLineNumbers copy +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql +X-Auth-Token: {{token}} + +query { + store { + translations(filters: { + resourceType: TAX_RATES, + channelId: "bc/store/channel/{{channel_id}}", + localeId: "bc/store/locale/{{locale_code}}" + }) { + edges { + node { + resourceId + fields { + fieldName + original + translation + } + } + cursor + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } + } +} +``` + + + + +```json filename="Example query: Query a list of translations" showLineNumbers copy +{ + "data": { + "store": { + "translations": { + "edges": [ + { + "node": { + "resourceId": "bc/store/taxRate/1", + "fields": [ + { + "fieldName": "tax_rate_name", + "original": "Standard Tax Rate", + "translation": "Tasa de Impuesto Estándar" + } + ] + }, + "cursor": "eyJyZXNvdXJjZUlkIjoxfQ" + } + ], + "pageInfo": { + "hasNextPage": false, + "hasPreviousPage": false, + "startCursor": "eyJyZXNvdXJjZUlkIjoxfQ", + "endCursor": "eyJyZXNvdXJjZUlkIjoxfQ" + } + } + } + } +} +``` + + + + +### Query a Translation by Resource ID + +This query returns translation(s) by `resourceId`. + + +When querying by `resourceId`, provide the full ID in the format `bc/store/taxRate/{id}`. + + + + + +```graphql filename="Example query: Query a translation by id" showLineNumbers copy +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql +X-Auth-Token: {{token}} + +query { + store { + translations( + filters: { + resourceType: TAX_RATES + channelId: "bc/store/channel/{{channel_id}}" + localeId: "bc/store/locale/{{locale_code}}" + resourceIds: ["bc/store/taxRate/1"] + } + ) { + edges { + node { + resourceId + fields { + fieldName + original + translation + } + } + cursor + } + } + } +} +``` + + + + +```json filename="Example query: Query a translation by id" showLineNumbers copy +{ + "data": { + "store": { + "translations": { + "edges": [ + { + "node": { + "resourceId": "bc/store/taxRate/1", + "fields": [ + { + "fieldName": "tax_rate_name", + "original": "Standard Tax Rate", + "translation": "Tasa de Impuesto Estándar" + } + ] + }, + "cursor": "eyJyZXNvdXJjZUlkIjoxfQ" + } + ] + } + } + } +} +``` + + + + +### Update a Translation + + + + +```graphql filename="Example mutation: Update a translation" showLineNumbers copy +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql +X-Auth-Token: {{token}} + +mutation { + translation { + updateTranslations(input: { + resourceType: TAX_RATES, + channelId: "bc/store/channel/{{channel_id}}", + localeId: "bc/store/locale/{{locale_code}}", + entities: [ + { + resourceId: "bc/store/taxRate/1", + fields: [ + { + fieldName: "tax_rate_name", + value: "Tasa de Impuesto Estándar" + } + ] + } + ] + }) { + errors { + __typename + ... on Error { + message + } + ... on EntityNotFoundError { + message + } + ... on ValidationError { + message + } + } + } + } +} +``` + + + + +```json filename="Example mutation: Update a translation" showLineNumbers copy +{ + "data": { + "translation": { + "updateTranslations": { + "errors": [] + } + } + } +} +``` + + + + +### Delete a Translation + + + + +```graphql filename="Example mutation: Delete a translation" showLineNumbers copy +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql +X-Auth-Token: {{token}} + +mutation { + translation { + deleteTranslations(input: { + resourceType: TAX_RATES, + channelId: "bc/store/channel/{{channel_id}}", + localeId: "bc/store/locale/{{locale_code}}", + resources: [ + { + resourceId: "bc/store/taxRate/1", + fields: ["tax_rate_name"] + } + ] + }) { + errors { + __typename + ... on Error { + message + } + ... on EntityNotFoundError { + message + } + ... on ValidationError { + message + } + } + } + } +} +``` + + + + +```json filename="Example mutation: Delete a translation" showLineNumbers copy +{ + "data": { + "translation": { + "deleteTranslations": { + "errors": [] + } + } + } +} +``` + + + +