-
Notifications
You must be signed in to change notification settings - Fork 57
Add Order Statuses and Promotions Translation Documentation #1221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kristinapototska
wants to merge
6
commits into
main
Choose a base branch
from
CSS-1937-1953-order-statuses-promotions-translations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bc6af5a
Add Order Statuses and Promotions translation docs
kristinapototska 84fc3eb
Clarify order status IDs are static and link to REST docs
kristinapototska 5bdad7b
Clarify order status IDs and restrict promotion fields
kristinapototska c1937ca
Merge branch 'main' into CSS-1937-1953-order-statuses-promotions-tran…
kristinapototska d996ea7
Apply suggestions from code review
bc-terra 489a0b7
Apply suggestions from code review
bc-terra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,337 @@ | ||
| # Translations for Order Statuses (Beta) | ||
|
|
||
| <Callout type='info'> | ||
| The Translations Admin GraphQL API is currently available on Catalyst | ||
| storefronts only. | ||
| </Callout> | ||
|
|
||
| The following entities are translatable for order statuses: | ||
|
|
||
| - Label as `label` | ||
|
|
||
kristinapototska marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <Callout type='info'> | ||
| Order status IDs are predefined and static (0–14). Merchants can only change the status name. See the [Order Status REST API](https://developer.bigcommerce.com/docs/rest-management/orders/order-status#get-all-order-statuses) for the full list of statuses and their IDs. | ||
| </Callout> | ||
|
|
||
| ## Resource fields | ||
|
|
||
| | Entity Type | `resourceType` | `resourceId` Format | | ||
| | --------------- | ----------------- | ---------------------------------- | | ||
| | Order Status | `ORDER_STATUSES` | `bc/store/orderStatus/{status_id}` | | ||
|
|
||
| ## Examples | ||
|
|
||
| Below are examples of GraphQL queries and mutations for retrieving and managing translation settings for order statuses. | ||
|
|
||
| ### Query a List of Translations | ||
|
|
||
| This query returns up to 50 order status translations for the specified resource type, channel, and locale. | ||
|
|
||
| The request below uses several variables for reusability. Replace `{{channel_id}}` and `{{locale_code}}` with the appropriate values for your use case. | ||
bc-terra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <Tabs items={['Request', 'Response']}> | ||
| <Tab> | ||
|
|
||
| ```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: ORDER_STATUSES | ||
| channelId: "bc/store/channel/{{channel_id}}" | ||
| localeId: "bc/store/locale/{{locale_code}}" | ||
| } | ||
| first: 2 | ||
| ) { | ||
| edges { | ||
| node { | ||
| resourceId | ||
| fields { | ||
| fieldName | ||
| original | ||
| translation | ||
| } | ||
| } | ||
| cursor | ||
| } | ||
| pageInfo { | ||
| hasNextPage | ||
| hasPreviousPage | ||
| startCursor | ||
| endCursor | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </Tab> | ||
| <Tab> | ||
|
|
||
| ```json filename="Example query: Query a list of translations" showLineNumbers copy | ||
| { | ||
| "data": { | ||
| "store": { | ||
| "translations": { | ||
| "edges": [ | ||
| { | ||
| "node": { | ||
| "resourceId": "bc/store/orderStatus/0", | ||
| "fields": [ | ||
| { | ||
| "fieldName": "label", | ||
| "original": "Incomplete", | ||
| "translation": "Incomplete (FR)" | ||
| } | ||
| ] | ||
| }, | ||
| "cursor": "eyJpZCI6MH0" | ||
| }, | ||
| { | ||
| "node": { | ||
| "resourceId": "bc/store/orderStatus/1", | ||
| "fields": [ | ||
| { | ||
| "fieldName": "label", | ||
| "original": "Pending", | ||
| "translation": "Pending (FR)" | ||
| } | ||
| ] | ||
| }, | ||
| "cursor": "eyJpZCI6MX0" | ||
| } | ||
| ], | ||
| "pageInfo": { | ||
| "hasNextPage": true, | ||
| "hasPreviousPage": false, | ||
| "startCursor": "eyJpZCI6MH0", | ||
| "endCursor": "eyJpZCI6MX0" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ### Query a Translation by Resource ID | ||
|
|
||
| This query returns translation(s) by resourceId. | ||
bc-terra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| The request below uses several variables for reusability. Replace `{{resourceId}}`, `{{channel_id}}`, and `{{locale_code}}` with appropriate values for your use case. Make sure `resourceId` follows the format from the [Resource fields](#resource-fields) table. | ||
bc-terra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| <Tabs items={['Request', 'Response']}> | ||
| <Tab> | ||
|
|
||
| ```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: ORDER_STATUSES | ||
| channelId: "bc/store/channel/{{channel_id}}" | ||
| localeId: "bc/store/locale/{{locale_code}}" | ||
| resourceIds: ["{{resourceId}}"] | ||
| } | ||
| ) { | ||
| edges { | ||
| node { | ||
| resourceId | ||
| fields { | ||
| fieldName | ||
| original | ||
| translation | ||
| } | ||
| } | ||
| cursor | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </Tab> | ||
| <Tab> | ||
|
|
||
| ```json filename="Example query: Query a translation by id" showLineNumbers copy | ||
| { | ||
| "data": { | ||
| "store": { | ||
| "translations": { | ||
| "edges": [ | ||
| { | ||
| "node": { | ||
| "resourceId": "bc/store/orderStatus/1", | ||
| "fields": [ | ||
| { | ||
| "fieldName": "label", | ||
| "original": "Pending", | ||
| "translation": "Pending (FR)" | ||
| } | ||
| ] | ||
| }, | ||
| "cursor": "eyJpZCI6MX0" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ### Update a Translation | ||
|
|
||
| This mutation updates translated values for order statuses for a specific channel and locale. | ||
|
|
||
| <Tabs items={['Request', 'Response']}> | ||
| <Tab> | ||
|
|
||
| ```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: ORDER_STATUSES, | ||
| channelId: "bc/store/channel/{{channel_id}}", | ||
| localeId: "bc/store/locale/{{locale_code}}", | ||
| entities: [ | ||
| { | ||
| resourceId: "bc/store/orderStatus/0", | ||
| fields: [ | ||
| { fieldName: "label", value: "Incomplete (FR)" } | ||
| ] | ||
| }, | ||
| { | ||
| resourceId: "bc/store/orderStatus/1", | ||
| fields: [ | ||
| { fieldName: "label", value: "Pending (FR)" } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ) { | ||
| __typename | ||
| errors { | ||
| __typename | ||
| ... on ValidationError { | ||
| message | ||
| } | ||
| ... on EntityNotFoundError { | ||
| id | ||
| message | ||
| } | ||
| ... on InvalidTranslationEntityFieldsError { | ||
| id | ||
| message | ||
| fields | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </Tab> | ||
| <Tab> | ||
|
|
||
| ```json filename="Example mutation: Update a translation" showLineNumbers copy | ||
| { | ||
| "data": { | ||
| "translation": { | ||
| "updateTranslations": { | ||
| "__typename": "UpdateTranslationsResult", | ||
| "errors": [] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ### Delete a Translation | ||
|
|
||
| The following mutation removes translated values for specified order status fields, reverting them to the original values for a specific channel and locale. | ||
|
|
||
| <Tabs items={['Request', 'Response']}> | ||
| <Tab> | ||
|
|
||
| ```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: ORDER_STATUSES, | ||
| channelId: "bc/store/channel/{{channel_id}}", | ||
| localeId: "bc/store/locale/{{locale_code}}", | ||
| resources: [ | ||
| { | ||
| resourceId: "bc/store/orderStatus/0", | ||
| fields: ["label"] | ||
| }, | ||
| { | ||
| resourceId: "bc/store/orderStatus/1", | ||
| fields: ["label"] | ||
| } | ||
| ] | ||
| } | ||
| ) { | ||
| __typename | ||
| errors { | ||
| __typename | ||
| ... on ValidationError { | ||
| message | ||
| } | ||
| ... on EntityNotFoundError { | ||
| id | ||
| message | ||
| } | ||
| ... on InvalidTranslationEntityFieldsError { | ||
| id | ||
| message | ||
| fields | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </Tab> | ||
| <Tab> | ||
|
|
||
| ```json filename="Example mutation: Delete a translation" showLineNumbers copy | ||
| { | ||
| "data": { | ||
| "translation": { | ||
| "deleteTranslations": { | ||
| "__typename": "DeleteTranslationsResult", | ||
| "errors": [] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </Tab> | ||
| </Tabs> | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.