Anchor to section titled 'undefined'

locationDeactivate
mutation

Requires write_locations access scope.

Deactivates a location and moves inventory, pending orders, and moving transfers to a destination location.


The ID of a destination location to which inventory, pending orders and moving transfers will be moved from the location to deactivate.

Anchor to locationId
locationId
required

The ID of a location to deactivate.


Was this section helpful?

The location that was deactivated.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
mutation locationDeactivate {
  locationDeactivate(locationId: "gid://shopify/Location/922479430") {
    location {
      id
      isActive
    }
    locationDeactivateUserErrors {
      message
      code
      field
    }
  }
}
Hide code
Response
JSON
{
  "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"
        ]
      }
    ]
  }
}