shop Locale Enablemutation
mutation
2024-10latest
Requires write
access scope.
Adds a locale for a shop. The newly added locale is in the unpublished state.
Arguments
ISO code of the locale to enable.
Anchor to marketWebPresenceIdsmarketWebPresenceIdsThe list of markets web presences to add the locale to.
Was this section helpful?
ShopLocaleEnablePayload returns
ISO code of the locale that was enabled.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: shopLocaleEnable
Query Reference for MUTATION: shopLocaleEnable
"mutation shopLocaleEnable($locale: String!) {\n shopLocaleEnable(locale: $locale) {\n shopLocale {\n # ShopLocale fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: shopLocaleEnable
"{\n \"locale\": \"<your-locale>\",\n \"marketWebPresenceIds\": [\n \"gid://shopify/<objectName>/10079785100\"\n ]\n}"
Schema Reference for MUTATION: shopLocaleEnable
""
Display Examples for MUTATION: shopLocaleEnable
[ { "example": { "type_name": "shoplocaleenable", "title": "Enable a locale", "description": "A locale must be enabled before it can be published. The shopLocaleEnable mutation takes a locale tag. The shop locale is requested in the response to verify that the localewas enabled correctly. A shop can have up to 20 enabled locales.", "query_string": "mutation enableLocale($locale: String!) {\n shopLocaleEnable(locale: $locale) {\n userErrors {\n message\n field\n }\n shopLocale {\n locale\n name\n primary\n published\n }\n }\n}", "query_arguments": { "locale": "$locale" }, "variables": { "locale": "ko" }, "response": { "data": { "shopLocaleEnable": { "userErrors": [], "shopLocale": { "locale": "ko", "name": "Korean", "primary": false, "published": false } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/markets/store_localization/test/unit/graph_api/admin/mutations/shop_locale_enable_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation enableLocale($locale: String!) { shopLocaleEnable(locale: $locale) { userErrors { message field } shopLocale { locale name primary published } } }\",\n \"variables\": {\n \"locale\": \"ko\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation enableLocale($locale: String!) {\n shopLocaleEnable(locale: $locale) {\n userErrors {\n message\n field\n }\n shopLocale {\n locale\n name\n primary\n published\n }\n }\n }`,\n {\n variables: {\n \"locale\": \"ko\"\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation enableLocale($locale: String!) {\n shopLocaleEnable(locale: $locale) {\n userErrors {\n message\n field\n }\n shopLocale {\n locale\n name\n primary\n published\n }\n }\n }\nQUERY\n\nvariables = {\n \"locale\": \"ko\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation enableLocale($locale: String!) {\n shopLocaleEnable(locale: $locale) {\n userErrors {\n message\n field\n }\n shopLocale {\n locale\n name\n primary\n published\n }\n }\n }`,\n \"variables\": {\n \"locale\": \"ko\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation enableLocale($locale: String!) {\n shopLocaleEnable(locale: $locale) {\n userErrors {\n message\n field\n }\n shopLocale {\n locale\n name\n primary\n published\n }\n }\n }\nQUERY;\n\n$variables = [\n \"locale\" => \"ko\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "locale", "description": "ISO code of the locale to enable.", "type": { "kind": "SCALAR", "name": "String", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "String!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "locale", "argValue": " \"ko\"", "typeKind": "MUTATION" } ] } ]