--- title: locationEdit - GraphQL Admin description: |- Edits an existing location. [As of the 2023-10 API version](https://shopify.dev/changelog/apps-can-now-change-the-name-and-address-of-their-fulfillment-service-locations), apps can change the name and address of their fulfillment service locations. api_version: 2025-10 api_name: admin type: mutation api_type: graphql source_url: html: https://shopify.dev/docs/api/admin-graphql/latest/mutations/locationEdit md: https://shopify.dev/docs/api/admin-graphql/latest/mutations/locationEdit.md --- # location​Edit mutation Requires `write_locations` access scope or `write_fulfillments` access scope. Also: `write_locations`: access scope is required to modify merchant-managed locations. `write_fulfillments`: apps can edit the locations associated with their fulfillment services if they have this scope. Only the app that created the fulfillment service can edit its associated location. Edits an existing location. [As of the 2023-10 API version](https://shopify.dev/changelog/apps-can-now-change-the-name-and-address-of-their-fulfillment-service-locations), apps can change the name and address of their fulfillment service locations. ## Arguments * id [ID!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID) required The ID of a location to edit. * input [Location​Edit​Input!](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/LocationEditInput) required The updated properties for the location. *** ## Location​Edit​Payload returns * location [Location](https://shopify.dev/docs/api/admin-graphql/latest/objects/Location) The location that was edited. * user​Errors [\[Location​Edit​User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/latest/objects/LocationEditUserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### Create a new metafield and update another on an existing location #### Description Create a new metafield \`my\_field.delivery\_type\` and update an existing metafield \`global.store\_hours\` on a specific location. Alternatively, refer to the \[metafieldsSet]\(https\://shopify.dev/api/admin-graphql/latest/mutations/metafieldsset) mutation to create and/or update metafields on location resources. #### Query ```graphql mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) { locationEdit(input: $input, id: $ownerId) { location { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } } ``` #### Variables ```json { "input": { "metafields": [ { "namespace": "my_field", "key": "delivery_type", "type": "single_line_text_field", "value": "local" }, { "id": "gid://shopify/Metafield/1069229306", "value": "Open from 7am to 10pm" } ] }, "ownerId": "gid://shopify/Location/346779380" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) { locationEdit(input: $input, id: $ownerId) { location { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } }", "variables": { "input": { "metafields": [ { "namespace": "my_field", "key": "delivery_type", "type": "single_line_text_field", "value": "local" }, { "id": "gid://shopify/Metafield/1069229306", "value": "Open from 7am to 10pm" } ] }, "ownerId": "gid://shopify/Location/346779380" } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) { locationEdit(input: $input, id: $ownerId) { location { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } }`, { variables: { "input": { "metafields": [ { "namespace": "my_field", "key": "delivery_type", "type": "single_line_text_field", "value": "local" }, { "id": "gid://shopify/Metafield/1069229306", "value": "Open from 7am to 10pm" } ] }, "ownerId": "gid://shopify/Location/346779380" }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby 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 updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) { locationEdit(input: $input, id: $ownerId) { location { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } } QUERY variables = { "input": { "metafields": [ { "namespace": "my_field", "key": "delivery_type", "type": "single_line_text_field", "value": "local" }, { "id": "gid://shopify/Metafield/1069229306", "value": "Open from 7am to 10pm" } ] }, "ownerId": "gid://shopify/Location/346779380" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) { locationEdit(input: $input, id: $ownerId) { location { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } }`, "variables": { "input": { "metafields": [ { "namespace": "my_field", "key": "delivery_type", "type": "single_line_text_field", "value": "local" }, { "id": "gid://shopify/Metafield/1069229306", "value": "Open from 7am to 10pm" } ] }, "ownerId": "gid://shopify/Location/346779380" }, }, }); ``` #### Response ```json { "locationEdit": { "location": { "id": "gid://shopify/Location/346779380", "metafields": { "edges": [ { "node": { "id": "gid://shopify/Metafield/1069229306", "namespace": "global", "key": "store_hours", "value": "Open from 7am to 10pm" } }, { "node": { "id": "gid://shopify/Metafield/1069229307", "namespace": "my_field", "key": "delivery_type", "value": "local" } } ] } }, "userErrors": [] } } ``` * ### Edit a location and return the location ID #### Description Edit a location's name, address and fulfillsOnlineOrders status #### Query ```graphql mutation locationEdit { locationEdit(id: "gid://shopify/Location/346779380", input: {name: "Shipping Warehouse", address: {address1: "290 Bremner Blvd", city: "Toronto", zip: "M5V 3L9", provinceCode: "ON", countryCode: CA}, fulfillsOnlineOrders: false}) { location { id name address { address1 provinceCode countryCode zip } fulfillsOnlineOrders } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation locationEdit { locationEdit(id: \"gid://shopify/Location/346779380\", input: {name: \"Shipping Warehouse\", address: {address1: \"290 Bremner Blvd\", city: \"Toronto\", zip: \"M5V 3L9\", provinceCode: \"ON\", countryCode: CA}, fulfillsOnlineOrders: false}) { location { id name address { address1 provinceCode countryCode zip } fulfillsOnlineOrders } } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation locationEdit { locationEdit(id: "gid://shopify/Location/346779380", input: {name: "Shipping Warehouse", address: {address1: "290 Bremner Blvd", city: "Toronto", zip: "M5V 3L9", provinceCode: "ON", countryCode: CA}, fulfillsOnlineOrders: false}) { location { id name address { address1 provinceCode countryCode zip } fulfillsOnlineOrders } } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby 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 locationEdit { locationEdit(id: "gid://shopify/Location/346779380", input: {name: "Shipping Warehouse", address: {address1: "290 Bremner Blvd", city: "Toronto", zip: "M5V 3L9", provinceCode: "ON", countryCode: CA}, fulfillsOnlineOrders: false}) { location { id name address { address1 provinceCode countryCode zip } fulfillsOnlineOrders } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `mutation locationEdit { locationEdit(id: "gid://shopify/Location/346779380", input: {name: "Shipping Warehouse", address: {address1: "290 Bremner Blvd", city: "Toronto", zip: "M5V 3L9", provinceCode: "ON", countryCode: CA}, fulfillsOnlineOrders: false}) { location { id name address { address1 provinceCode countryCode zip } fulfillsOnlineOrders } } }`, }); ``` #### Response ```json { "locationEdit": { "location": { "id": "gid://shopify/Location/346779380", "name": "Shipping Warehouse", "address": { "address1": "290 Bremner Blvd", "provinceCode": "ON", "countryCode": "CA", "zip": "M5V 3L9" }, "fulfillsOnlineOrders": false } } } ``` * ### locationEdit reference [Open in GraphiQL](http://localhost:3457/graphiql?query=mutation%20updateLocationMetafields\(%24input%3A%20LocationEditInput!%2C%20%24ownerId%3A%20ID!\)%20%7B%0A%20%20locationEdit\(input%3A%20%24input%2C%20id%3A%20%24ownerId\)%20%7B%0A%20%20%20%20location%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20metafields\(first%3A%203\)%20%7B%0A%20%20%20%20%20%20%20%20edges%20%7B%0A%20%20%20%20%20%20%20%20%20%20node%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20id%0A%20%20%20%20%20%20%20%20%20%20%20%20namespace%0A%20%20%20%20%20%20%20%20%20%20%20%20key%0A%20%20%20%20%20%20%20%20%20%20%20%20value%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20userErrors%20%7B%0A%20%20%20%20%20%20message%0A%20%20%20%20%20%20field%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22input%22%3A%20%7B%0A%20%20%20%20%22metafields%22%3A%20%5B%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22namespace%22%3A%20%22my_field%22%2C%0A%20%20%20%20%20%20%20%20%22key%22%3A%20%22delivery_type%22%2C%0A%20%20%20%20%20%20%20%20%22type%22%3A%20%22single_line_text_field%22%2C%0A%20%20%20%20%20%20%20%20%22value%22%3A%20%22local%22%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22id%22%3A%20%22gid%3A%2F%2Fshopify%2FMetafield%2F1069229306%22%2C%0A%20%20%20%20%20%20%20%20%22value%22%3A%20%22Open%20from%207am%20to%2010pm%22%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%5D%0A%20%20%7D%2C%0A%20%20%22ownerId%22%3A%20%22gid%3A%2F%2Fshopify%2FLocation%2F346779380%22%0A%7D) ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) { locationEdit(input: $input, id: $ownerId) { location { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } }`, { variables: { "input": { "metafields": [ { "namespace": "my_field", "key": "delivery_type", "type": "single_line_text_field", "value": "local" }, { "id": "gid://shopify/Metafield/1069229306", "value": "Open from 7am to 10pm" } ] }, "ownerId": "gid://shopify/Location/346779380" }, }, ); const json = await response.json(); return json.data; } ``` ##### GQL ``` mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) { locationEdit(input: $input, id: $ownerId) { location { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } } ``` ##### cURL ``` curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) { locationEdit(input: $input, id: $ownerId) { location { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } }", "variables": { "input": { "metafields": [ { "namespace": "my_field", "key": "delivery_type", "type": "single_line_text_field", "value": "local" }, { "id": "gid://shopify/Metafield/1069229306", "value": "Open from 7am to 10pm" } ] }, "ownerId": "gid://shopify/Location/346779380" } }' ``` ##### React Router ``` import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) { locationEdit(input: $input, id: $ownerId) { location { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } }`, { variables: { "input": { "metafields": [ { "namespace": "my_field", "key": "delivery_type", "type": "single_line_text_field", "value": "local" }, { "id": "gid://shopify/Metafield/1069229306", "value": "Open from 7am to 10pm" } ] }, "ownerId": "gid://shopify/Location/346779380" }, }, ); const json = await response.json(); return json.data; } ``` ##### Node.js ``` const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) { locationEdit(input: $input, id: $ownerId) { location { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } }`, "variables": { "input": { "metafields": [ { "namespace": "my_field", "key": "delivery_type", "type": "single_line_text_field", "value": "local" }, { "id": "gid://shopify/Metafield/1069229306", "value": "Open from 7am to 10pm" } ] }, "ownerId": "gid://shopify/Location/346779380" }, }, }); ``` ##### Ruby ``` 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 updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) { locationEdit(input: $input, id: $ownerId) { location { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } } QUERY variables = { "input": { "metafields": [ { "namespace": "my_field", "key": "delivery_type", "type": "single_line_text_field", "value": "local" }, { "id": "gid://shopify/Metafield/1069229306", "value": "Open from 7am to 10pm" } ] }, "ownerId": "gid://shopify/Location/346779380" } response = client.query(query: query, variables: variables) ``` ## Input variables JSON ```json { "input": { "metafields": [ { "namespace": "my_field", "key": "delivery_type", "type": "single_line_text_field", "value": "local" }, { "id": "gid://shopify/Metafield/1069229306", "value": "Open from 7am to 10pm" } ] }, "ownerId": "gid://shopify/Location/346779380" } ``` ## Response JSON ```json { "locationEdit": { "location": { "id": "gid://shopify/Location/346779380", "metafields": { "edges": [ { "node": { "id": "gid://shopify/Metafield/1069229306", "namespace": "global", "key": "store_hours", "value": "Open from 7am to 10pm" } }, { "node": { "id": "gid://shopify/Metafield/1069229307", "namespace": "my_field", "key": "delivery_type", "value": "local" } } ] } }, "userErrors": [] } } ```