Version: 2025-01
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 updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) { locationEdit(input: $input, id: $ownerId) { location { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } }\",\n \"variables\": {\n \"input\": {\n \"metafields\": [\n {\n \"namespace\": \"my_field\",\n \"key\": \"delivery_type\",\n \"type\": \"single_line_text_field\",\n \"value\": \"local\"\n },\n {\n \"id\": \"gid://shopify/Metafield/1069229306\",\n \"value\": \"Open from 7am to 10pm\"\n }\n ]\n },\n \"ownerId\": \"gid://shopify/Location/346779380\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) {\n locationEdit(input: $input, id: $ownerId) {\n location {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"metafields\": [\n {\n \"namespace\": \"my_field\",\n \"key\": \"delivery_type\",\n \"type\": \"single_line_text_field\",\n \"value\": \"local\"\n },\n {\n \"id\": \"gid://shopify/Metafield/1069229306\",\n \"value\": \"Open from 7am to 10pm\"\n }\n ]\n },\n \"ownerId\": \"gid://shopify/Location/346779380\"\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 updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) {\n locationEdit(input: $input, id: $ownerId) {\n location {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"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\"}]\n },\n \"ownerId\": \"gid://shopify/Location/346779380\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) {\n locationEdit(input: $input, id: $ownerId) {\n location {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"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\"}],\n ],\n \"ownerId\" => \"gid://shopify/Location/346779380\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) {\n locationEdit(input: $input, id: $ownerId) {\n location {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"metafields\": [\n {\n \"namespace\": \"my_field\",\n \"key\": \"delivery_type\",\n \"type\": \"single_line_text_field\",\n \"value\": \"local\"\n },\n {\n \"id\": \"gid://shopify/Metafield/1069229306\",\n \"value\": \"Open from 7am to 10pm\"\n }\n ]\n },\n \"ownerId\": \"gid://shopify/Location/346779380\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation updateLocationMetafields($input: LocationEditInput!, $ownerId: ID!) {\n locationEdit(input: $input, id: $ownerId) {\n location {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n}"
input: { "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: { "data": { "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": [] } } }
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 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 } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation locationEdit {\n 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}) {\n location {\n id\n name\n address {\n address1\n provinceCode\n countryCode\n zip\n }\n fulfillsOnlineOrders\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 locationEdit {\n 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}) {\n location {\n id\n name\n address {\n address1\n provinceCode\n countryCode\n zip\n }\n fulfillsOnlineOrders\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 locationEdit {\n 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}) {\n location {\n id\n name\n address {\n address1\n provinceCode\n countryCode\n zip\n }\n fulfillsOnlineOrders\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 locationEdit {\n 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}) {\n location {\n id\n name\n address {\n address1\n provinceCode\n countryCode\n zip\n }\n fulfillsOnlineOrders\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation locationEdit {\n 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}) {\n location {\n id\n name\n address {\n address1\n provinceCode\n countryCode\n zip\n }\n fulfillsOnlineOrders\n }\n }\n}"
input: null
response: { "data": { "locationEdit": { "location": { "id": "gid://shopify/Location/346779380", "name": "Shipping Warehouse", "address": { "address1": "290 Bremner Blvd", "provinceCode": "ON", "countryCode": "CA", "zip": "M5V 3L9" }, "fulfillsOnlineOrders": false } } } }