Anchor to shopLocalesshop
shopLocales
query
Requires access scope or
access scope.
A list of locales available on a shop.
Anchor to Arguments
Arguments
- Anchor to publishedpublished•BooleanDefault:false
Return only published locales.
Was this section helpful?
Anchor to Possible returnsPossible returns
- Anchor to ShopLocaleShop•
Locale A locale that's been enabled on a shop.
Was this section helpful?
Retrieve a shop's locales
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 query {6 shopLocales {7 locale8 primary9 published10 }11 }`,12);1314const data = await response.json();15
query {
shopLocales {
locale
primary
published
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { shopLocales { locale primary published } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
shopLocales {
locale
primary
published
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
shopLocales {
locale
primary
published
}
}`,
});
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
query {
shopLocales {
locale
primary
published
}
}
QUERY
response = client.query(query: query)
Response
JSON1{2 "shopLocales": [3 {4 "locale": "en",5 "primary": true,6 "published": true7 },8 {9 "locale": "es",10 "primary": false,11 "published": true12 },13 {14 "locale": "fr",15 "primary": false,16 "published": true17 },18 {19 "locale": "ja",20 "primary": false,21 "published": true22 }23 ]24}