Version: 2024-04
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation locationDeactivate { locationDeactivate(locationId: \\\"gid://shopify/Location/922479430\\\") { location { id isActive } locationDeactivateUserErrors { message code field } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation locationDeactivate {\n locationDeactivate(locationId: \"gid://shopify/Location/922479430\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n }`,\n});\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 locationDeactivate {\n locationDeactivate(locationId: \"gid://shopify/Location/922479430\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation locationDeactivate {\n locationDeactivate(locationId: \"gid://shopify/Location/922479430\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation locationDeactivate {\n locationDeactivate(locationId: \"gid://shopify/Location/922479430\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation locationDeactivate {\n locationDeactivate(locationId: \"gid://shopify/Location/922479430\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n}"
input: null
response: { "data": { "locationDeactivate": { "location": { "id": "gid://shopify/Location/922479430", "isActive": true }, "locationDeactivateUserErrors": [ { "message": "Location could not be deactivated without specifying where to relocate inventory stocked at the location.", "code": "HAS_ACTIVE_INVENTORY_ERROR", "field": [ "locationId" ] } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation locationDeactivate { locationDeactivate(locationId: \\\"gid://shopify/Location/123\\\") { location { id isActive } locationDeactivateUserErrors { message code field } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation locationDeactivate {\n locationDeactivate(locationId: \"gid://shopify/Location/123\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n }`,\n});\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 locationDeactivate {\n locationDeactivate(locationId: \"gid://shopify/Location/123\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation locationDeactivate {\n locationDeactivate(locationId: \"gid://shopify/Location/123\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation locationDeactivate {\n locationDeactivate(locationId: \"gid://shopify/Location/123\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation locationDeactivate {\n locationDeactivate(locationId: \"gid://shopify/Location/123\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n}"
input: null
response: { "data": { "locationDeactivate": { "location": null, "locationDeactivateUserErrors": [ { "message": "Location could not be deactivated because it has open purchase orders.", "code": "HAS_OPEN_PURCHASE_ORDERS_ERROR", "field": [ "locationId" ] } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation { locationDeactivate(locationId: \\\"gid://shopify/Location/922479430\\\", destinationLocationId: \\\"gid://shopify/Location/147921425\\\") { location { id isActive } locationDeactivateUserErrors { message code field } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation {\n locationDeactivate(locationId: \"gid://shopify/Location/922479430\", destinationLocationId: \"gid://shopify/Location/147921425\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n }`,\n});\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 {\n locationDeactivate(locationId: \"gid://shopify/Location/922479430\", destinationLocationId: \"gid://shopify/Location/147921425\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation {\n locationDeactivate(locationId: \"gid://shopify/Location/922479430\", destinationLocationId: \"gid://shopify/Location/147921425\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation {\n locationDeactivate(locationId: \"gid://shopify/Location/922479430\", destinationLocationId: \"gid://shopify/Location/147921425\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation {\n locationDeactivate(locationId: \"gid://shopify/Location/922479430\", destinationLocationId: \"gid://shopify/Location/147921425\") {\n location {\n id\n isActive\n }\n locationDeactivateUserErrors {\n message\n code\n field\n }\n }\n}"
input: null
response: { "data": { "locationDeactivate": { "location": { "id": "gid://shopify/Location/922479430", "isActive": false }, "locationDeactivateUserErrors": [] } } }