|
| 1 | +# Translations for Order Statuses (Beta) |
| 2 | + |
| 3 | +<Callout type='info'> |
| 4 | + The Translations Admin GraphQL API is currently available on Catalyst |
| 5 | + storefronts only. |
| 6 | +</Callout> |
| 7 | + |
| 8 | +The following entities are translatable for order statuses: |
| 9 | + |
| 10 | +- Label as `label` |
| 11 | + |
| 12 | +<Callout type='info'> |
| 13 | + 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. |
| 14 | +</Callout> |
| 15 | + |
| 16 | +## Resource fields |
| 17 | + |
| 18 | +| Entity Type | `resourceType` | `resourceId` Format | |
| 19 | +| --------------- | ----------------- | ---------------------------------- | |
| 20 | +| Order Status | `ORDER_STATUSES` | `bc/store/orderStatus/{status_id}` | |
| 21 | + |
| 22 | +## Examples |
| 23 | + |
| 24 | +Below are examples of GraphQL queries and mutations for retrieving and managing translation settings for order statuses. |
| 25 | + |
| 26 | +### Query a List of Translations |
| 27 | + |
| 28 | +This query returns up to 2 order status translations for the specified resource type, channel, and locale. |
| 29 | + |
| 30 | +The request below uses several variables for reusability. Replace `{{channel_id}}` and `{{locale_code}}` with the appropriate values for your use case. |
| 31 | + |
| 32 | +<Tabs items={['Request', 'Response']}> |
| 33 | +<Tab> |
| 34 | + |
| 35 | +```graphql filename="Example query: Query a list of translations" showLineNumbers copy |
| 36 | +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql |
| 37 | +X-Auth-Token: {{token}} |
| 38 | + |
| 39 | +query { |
| 40 | + store { |
| 41 | + translations( |
| 42 | + filters: { |
| 43 | + resourceType: ORDER_STATUSES |
| 44 | + channelId: "bc/store/channel/{{channel_id}}" |
| 45 | + localeId: "bc/store/locale/{{locale_code}}" |
| 46 | + } |
| 47 | + first: 2 |
| 48 | + ) { |
| 49 | + edges { |
| 50 | + node { |
| 51 | + resourceId |
| 52 | + fields { |
| 53 | + fieldName |
| 54 | + original |
| 55 | + translation |
| 56 | + } |
| 57 | + } |
| 58 | + cursor |
| 59 | + } |
| 60 | + pageInfo { |
| 61 | + hasNextPage |
| 62 | + hasPreviousPage |
| 63 | + startCursor |
| 64 | + endCursor |
| 65 | + } |
| 66 | + } |
| 67 | + } |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +</Tab> |
| 72 | +<Tab> |
| 73 | + |
| 74 | +```json filename="Example query: Query a list of translations" showLineNumbers copy |
| 75 | +{ |
| 76 | + "data": { |
| 77 | + "store": { |
| 78 | + "translations": { |
| 79 | + "edges": [ |
| 80 | + { |
| 81 | + "node": { |
| 82 | + "resourceId": "bc/store/orderStatus/0", |
| 83 | + "fields": [ |
| 84 | + { |
| 85 | + "fieldName": "label", |
| 86 | + "original": "Incomplete", |
| 87 | + "translation": "Incomplete (FR)" |
| 88 | + } |
| 89 | + ] |
| 90 | + }, |
| 91 | + "cursor": "eyJpZCI6MH0" |
| 92 | + }, |
| 93 | + { |
| 94 | + "node": { |
| 95 | + "resourceId": "bc/store/orderStatus/1", |
| 96 | + "fields": [ |
| 97 | + { |
| 98 | + "fieldName": "label", |
| 99 | + "original": "Pending", |
| 100 | + "translation": "Pending (FR)" |
| 101 | + } |
| 102 | + ] |
| 103 | + }, |
| 104 | + "cursor": "eyJpZCI6MX0" |
| 105 | + } |
| 106 | + ], |
| 107 | + "pageInfo": { |
| 108 | + "hasNextPage": true, |
| 109 | + "hasPreviousPage": false, |
| 110 | + "startCursor": "eyJpZCI6MH0", |
| 111 | + "endCursor": "eyJpZCI6MX0" |
| 112 | + } |
| 113 | + } |
| 114 | + } |
| 115 | + } |
| 116 | +} |
| 117 | +``` |
| 118 | + |
| 119 | +</Tab> |
| 120 | +</Tabs> |
| 121 | + |
| 122 | +### Query a Translation by Resource ID |
| 123 | + |
| 124 | +This query returns translation(s) by resourceId. |
| 125 | + |
| 126 | +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. |
| 127 | + |
| 128 | +<Tabs items={['Request', 'Response']}> |
| 129 | +<Tab> |
| 130 | + |
| 131 | +```graphql filename="Example query: Query a translation by id" showLineNumbers copy |
| 132 | +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql |
| 133 | +X-Auth-Token: {{token}} |
| 134 | + |
| 135 | +query { |
| 136 | + store { |
| 137 | + translations( |
| 138 | + filters: { |
| 139 | + resourceType: ORDER_STATUSES |
| 140 | + channelId: "bc/store/channel/{{channel_id}}" |
| 141 | + localeId: "bc/store/locale/{{locale_code}}" |
| 142 | + resourceIds: ["{{resourceId}}"] |
| 143 | + } |
| 144 | + ) { |
| 145 | + edges { |
| 146 | + node { |
| 147 | + resourceId |
| 148 | + fields { |
| 149 | + fieldName |
| 150 | + original |
| 151 | + translation |
| 152 | + } |
| 153 | + } |
| 154 | + cursor |
| 155 | + } |
| 156 | + } |
| 157 | + } |
| 158 | +} |
| 159 | +``` |
| 160 | + |
| 161 | +</Tab> |
| 162 | +<Tab> |
| 163 | + |
| 164 | +```json filename="Example query: Query a translation by id" showLineNumbers copy |
| 165 | +{ |
| 166 | + "data": { |
| 167 | + "store": { |
| 168 | + "translations": { |
| 169 | + "edges": [ |
| 170 | + { |
| 171 | + "node": { |
| 172 | + "resourceId": "bc/store/orderStatus/1", |
| 173 | + "fields": [ |
| 174 | + { |
| 175 | + "fieldName": "label", |
| 176 | + "original": "Pending", |
| 177 | + "translation": "Pending (FR)" |
| 178 | + } |
| 179 | + ] |
| 180 | + }, |
| 181 | + "cursor": "eyJpZCI6MX0" |
| 182 | + } |
| 183 | + ] |
| 184 | + } |
| 185 | + } |
| 186 | + } |
| 187 | +} |
| 188 | +``` |
| 189 | + |
| 190 | +</Tab> |
| 191 | +</Tabs> |
| 192 | + |
| 193 | +### Update a Translation |
| 194 | + |
| 195 | +This mutation updates translated values for order statuses for a specific channel and locale. |
| 196 | + |
| 197 | +<Tabs items={['Request', 'Response']}> |
| 198 | +<Tab> |
| 199 | + |
| 200 | +```graphql filename="Example mutation: Update a translation" showLineNumbers copy |
| 201 | +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql |
| 202 | +X-Auth-Token: {{token}} |
| 203 | + |
| 204 | +mutation { |
| 205 | + translation { |
| 206 | + updateTranslations( |
| 207 | + input: { |
| 208 | + resourceType: ORDER_STATUSES, |
| 209 | + channelId: "bc/store/channel/{{channel_id}}", |
| 210 | + localeId: "bc/store/locale/{{locale_code}}", |
| 211 | + entities: [ |
| 212 | + { |
| 213 | + resourceId: "bc/store/orderStatus/0", |
| 214 | + fields: [ |
| 215 | + { fieldName: "label", value: "Incomplete (FR)" } |
| 216 | + ] |
| 217 | + }, |
| 218 | + { |
| 219 | + resourceId: "bc/store/orderStatus/1", |
| 220 | + fields: [ |
| 221 | + { fieldName: "label", value: "Pending (FR)" } |
| 222 | + ] |
| 223 | + } |
| 224 | + ] |
| 225 | + } |
| 226 | + ) { |
| 227 | + __typename |
| 228 | + errors { |
| 229 | + __typename |
| 230 | + ... on ValidationError { |
| 231 | + message |
| 232 | + } |
| 233 | + ... on EntityNotFoundError { |
| 234 | + id |
| 235 | + message |
| 236 | + } |
| 237 | + ... on InvalidTranslationEntityFieldsError { |
| 238 | + id |
| 239 | + message |
| 240 | + fields |
| 241 | + } |
| 242 | + } |
| 243 | + } |
| 244 | + } |
| 245 | +} |
| 246 | +``` |
| 247 | + |
| 248 | +</Tab> |
| 249 | +<Tab> |
| 250 | + |
| 251 | +```json filename="Example mutation: Update a translation" showLineNumbers copy |
| 252 | +{ |
| 253 | + "data": { |
| 254 | + "translation": { |
| 255 | + "updateTranslations": { |
| 256 | + "__typename": "UpdateTranslationsResult", |
| 257 | + "errors": [] |
| 258 | + } |
| 259 | + } |
| 260 | + } |
| 261 | +} |
| 262 | +``` |
| 263 | + |
| 264 | +</Tab> |
| 265 | +</Tabs> |
| 266 | + |
| 267 | +### Delete a Translation |
| 268 | + |
| 269 | +The following mutation removes translated values for specified order status fields, reverting them to the original values for a specific channel and locale. |
| 270 | + |
| 271 | +<Tabs items={['Request', 'Response']}> |
| 272 | +<Tab> |
| 273 | + |
| 274 | +```graphql filename="Example mutation: Delete a translation" showLineNumbers copy |
| 275 | +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql |
| 276 | +X-Auth-Token: {{token}} |
| 277 | + |
| 278 | +mutation { |
| 279 | + translation { |
| 280 | + deleteTranslations( |
| 281 | + input: { |
| 282 | + resourceType: ORDER_STATUSES, |
| 283 | + channelId: "bc/store/channel/{{channel_id}}", |
| 284 | + localeId: "bc/store/locale/{{locale_code}}", |
| 285 | + resources: [ |
| 286 | + { |
| 287 | + resourceId: "bc/store/orderStatus/0", |
| 288 | + fields: ["label"] |
| 289 | + }, |
| 290 | + { |
| 291 | + resourceId: "bc/store/orderStatus/1", |
| 292 | + fields: ["label"] |
| 293 | + } |
| 294 | + ] |
| 295 | + } |
| 296 | + ) { |
| 297 | + __typename |
| 298 | + errors { |
| 299 | + __typename |
| 300 | + ... on ValidationError { |
| 301 | + message |
| 302 | + } |
| 303 | + ... on EntityNotFoundError { |
| 304 | + id |
| 305 | + message |
| 306 | + } |
| 307 | + ... on InvalidTranslationEntityFieldsError { |
| 308 | + id |
| 309 | + message |
| 310 | + fields |
| 311 | + } |
| 312 | + } |
| 313 | + } |
| 314 | + } |
| 315 | +} |
| 316 | +``` |
| 317 | + |
| 318 | +</Tab> |
| 319 | +<Tab> |
| 320 | + |
| 321 | +```json filename="Example mutation: Delete a translation" showLineNumbers copy |
| 322 | +{ |
| 323 | + "data": { |
| 324 | + "translation": { |
| 325 | + "deleteTranslations": { |
| 326 | + "__typename": "DeleteTranslationsResult", |
| 327 | + "errors": [] |
| 328 | + } |
| 329 | + } |
| 330 | + } |
| 331 | +} |
| 332 | +``` |
| 333 | + |
| 334 | +</Tab> |
| 335 | +</Tabs> |
| 336 | + |
| 337 | + |
0 commit comments