# locationDeactivate - admin-graphql - MUTATION Version: 2025-01 ## Description Deactivates a location and moves inventory, pending orders, and moving transfers to a destination location. ### Access Scopes `write_locations` access scope. ## Arguments * [destinationLocationId](/docs/api/admin-graphql/2025-01/scalars/ID): ID - The ID of a destination location to which inventory, pending orders and moving transfers will be moved from the location to deactivate. * [locationId](/docs/api/admin-graphql/2025-01/scalars/ID): ID! - The ID of a location to deactivate. ## Returns * [location](/docs/api/admin-graphql/2025-01/objects/Location): Location The location that was deactivated. * [locationDeactivateUserErrors](/docs/api/admin-graphql/2025-01/objects/LocationDeactivateUserError): LocationDeactivateUserError! The list of errors that occurred from executing the mutation. ## Examples ### Deactivate a location with active inventory Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input null #### Graphql 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" ] } ] } } } ### Deactivate a location with pending orders Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input null #### Graphql 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" ] } ] } } } ### Deactivate an active location Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input null #### Graphql Response { "data": { "locationDeactivate": { "location": { "id": "gid://shopify/Location/922479430", "isActive": false }, "locationDeactivateUserErrors": [] } } }