Anchor to shopLocaleEnableshop
shopLocaleEnable
mutation
Requires access scope.
Adds a locale for a shop. The newly added locale is in the unpublished state.
Anchor to Arguments
Arguments
- Anchor to localelocale•String!required
ISO code of the locale to enable.
- Anchor to marketWebPresenceIdsmarket•
Web Presence Ids The list of markets web presences to add the locale to.
Was this section helpful?
Anchor to ShopLocaleEnablePayload returnsShopLocaleEnablePayload returns
- Anchor to shopLocaleshop•
Locale ISO code of the locale that was enabled.
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
Was this section helpful?
- Enable a locale
- shopLocaleEnable reference
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 mutation enableLocale($locale: String!) {6 shopLocaleEnable(locale: $locale) {7 userErrors {8 message9 field10 }11 shopLocale {12 locale13 name14 primary15 published16 }17 }18 }`,19 {20 variables: {21 "locale": "ko"22 },23 },24);2526const data = await response.json();27
mutation enableLocale($locale: String!) {
shopLocaleEnable(locale: $locale) {
userErrors {
message
field
}
shopLocale {
locale
name
primary
published
}
}
}
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 enableLocale($locale: String!) { shopLocaleEnable(locale: $locale) { userErrors { message field } shopLocale { locale name primary published } } }",
"variables": {
"locale": "ko"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation enableLocale($locale: String!) {
shopLocaleEnable(locale: $locale) {
userErrors {
message
field
}
shopLocale {
locale
name
primary
published
}
}
}`,
{
variables: {
"locale": "ko"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation enableLocale($locale: String!) {
shopLocaleEnable(locale: $locale) {
userErrors {
message
field
}
shopLocale {
locale
name
primary
published
}
}
}`,
"variables": {
"locale": "ko"
},
},
});
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 enableLocale($locale: String!) {
shopLocaleEnable(locale: $locale) {
userErrors {
message
field
}
shopLocale {
locale
name
primary
published
}
}
}
QUERY
variables = {
"locale": "ko"
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "locale": "ko"3}
Response
JSON1{2 "shopLocaleEnable": {3 "userErrors": [],4 "shopLocale": {5 "locale": "ko",6 "name": "Korean",7 "primary": false,8 "published": false9 }10 }11}