Anchor to locationDeletelocation
locationDelete
mutation
Requires access scope.
Deletes a location.
Anchor to Arguments
Arguments
- Anchor to locationIdlocation•
Id ID!required The ID of a location to delete.
Was this section helpful?
Anchor to LocationDeletePayload returnsLocationDeletePayload returns
- Anchor to deletedLocationIddeleted•
Location Id The ID of the location that was deleted.
- Anchor to locationDeleteUserErrorslocation•
Delete User Errors [LocationDelete non-nullUser Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Delete a location and return the location ID
- Delete an active location
- locationDelete reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation {
locationDelete(locationId: "gid://shopify/Location/658095763") {
deletedLocationId
}
}`,
);
const data = await response.json();
mutation {
locationDelete(locationId: "gid://shopify/Location/658095763") {
deletedLocationId
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation { locationDelete(locationId: \"gid://shopify/Location/658095763\") { deletedLocationId } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation {
locationDelete(locationId: "gid://shopify/Location/658095763") {
deletedLocationId
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `mutation {
locationDelete(locationId: "gid://shopify/Location/658095763") {
deletedLocationId
}
}`,
});
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
mutation {
locationDelete(locationId: "gid://shopify/Location/658095763") {
deletedLocationId
}
}
QUERY
response = client.query(query: query)
Response
JSON{
"locationDelete": {
"deletedLocationId": "gid://shopify/Location/658095763"
}
}