Anchor to translationsRemovetranslations
translationsRemove
mutation
Requires access scope.
Deletes translations.
Anchor to Arguments
Arguments
- Anchor to localeslocales•[String!]!required
The list of translation locales. Only locales returned in
are valid.
- Anchor to marketIdsmarket•
Ids The list of market IDs.
- Anchor to resourceIdresource•
Id ID!required ID of the translatable resource for which translations are being deleted.
- Anchor to translationKeystranslation•
Keys [String!]!required The list of translation keys.
Was this section helpful?
Anchor to TranslationsRemovePayload returnsTranslationsRemovePayload returns
- Anchor to translationstranslations•
The translations that were deleted.
- Anchor to userErrorsuser•
Errors [TranslationUser non-nullError!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Remove a French product title translation
- Remove a French product title translation specific to a market
- translationsRemove reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation translationsRemove($resourceId: ID!, $translationKeys: [String!]!, $locales: [String!]!) {
translationsRemove(resourceId: $resourceId, translationKeys: $translationKeys, locales: $locales) {
userErrors {
message
field
}
translations {
key
value
}
}
}`,
{
variables: {
"resourceId": "gid://shopify/Product/20995642",
"locales": [
"fr"
],
"translationKeys": [
"title"
]
},
},
);
mutation translationsRemove($resourceId: ID!, $translationKeys: [String!]!, $locales: [String!]!) {
translationsRemove(resourceId: $resourceId, translationKeys: $translationKeys, locales: $locales) {
userErrors {
message
field
}
translations {
key
value
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation translationsRemove($resourceId: ID!, $translationKeys: [String!]!, $locales: [String!]!) { translationsRemove(resourceId: $resourceId, translationKeys: $translationKeys, locales: $locales) { userErrors { message field } translations { key value } } }",
"variables": {
"resourceId": "gid://shopify/Product/20995642",
"locales": [
"fr"
],
"translationKeys": [
"title"
]
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation translationsRemove($resourceId: ID!, $translationKeys: [String!]!, $locales: [String!]!) {
translationsRemove(resourceId: $resourceId, translationKeys: $translationKeys, locales: $locales) {
userErrors {
message
field
}
translations {
key
value
}
}
}`,
{
variables: {
"resourceId": "gid://shopify/Product/20995642",
"locales": [
"fr"
],
"translationKeys": [
"title"
]
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation translationsRemove($resourceId: ID!, $translationKeys: [String!]!, $locales: [String!]!) {
translationsRemove(resourceId: $resourceId, translationKeys: $translationKeys, locales: $locales) {
userErrors {
message
field
}
translations {
key
value
}
}
}`,
"variables": {
"resourceId": "gid://shopify/Product/20995642",
"locales": [
"fr"
],
"translationKeys": [
"title"
]
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation translationsRemove($resourceId: ID!, $translationKeys: [String!]!, $locales: [String!]!) {
translationsRemove(resourceId: $resourceId, translationKeys: $translationKeys, locales: $locales) {
userErrors {
message
field
}
translations {
key
value
}
}
}
QUERY
variables = {
"resourceId": "gid://shopify/Product/20995642",
"locales": ["fr"],
"translationKeys": ["title"]
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"resourceId": "gid://shopify/Product/20995642",
"locales": [
"fr"
],
"translationKeys": [
"title"
]
}
Response
JSON{
"translationsRemove": {
"userErrors": [],
"translations": [
{
"key": "title",
"value": "L'élément"
}
]
}
}