# location - admin-graphql - QUERY Version: unstable ## Description Returns an inventory Location resource by ID. ### Access Scopes ## Arguments * [id](/docs/api/admin-graphql/unstable/scalars/ID): ID - The ID of the location to return. If no ID is provided, the primary location of the Shop is returned. ## Returns * [activatable](/docs/api/admin-graphql/unstable/scalars/Boolean): Boolean! Whether the location can be reactivated. If `false`, then trying to activate the location with the [`LocationActivate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/locationActivate) mutation will return an error that describes why the location can't be activated. * [address](/docs/api/admin-graphql/unstable/objects/LocationAddress): LocationAddress! The address of this location. * [addressVerified](/docs/api/admin-graphql/unstable/scalars/Boolean): Boolean! Whether the location address has been verified. * [createdAt](/docs/api/admin-graphql/unstable/scalars/DateTime): DateTime! The date and time ([ISO 8601 format](http://en.wikipedia.org/wiki/ISO_8601)) that the location was added to a shop. * [deactivatable](/docs/api/admin-graphql/unstable/scalars/Boolean): Boolean! Whether this location can be deactivated. If `true`, then the location can be deactivated by calling the [`LocationDeactivate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/locationDeactivate) mutation. If `false`, then calling the mutation to deactivate it will return an error that describes why the location can't be deactivated. * [deactivatedAt](/docs/api/admin-graphql/unstable/scalars/String): String The date and time ([ISO 8601 format](http://en.wikipedia.org/wiki/ISO_8601)) that the location was deactivated at. For example, 3:30 pm on September 7, 2019 in the time zone of UTC (Universal Time Coordinated) is represented as `"2019-09-07T15:50:00Z`". * [deletable](/docs/api/admin-graphql/unstable/scalars/Boolean): Boolean! Whether this location can be deleted. * [fulfillmentService](/docs/api/admin-graphql/unstable/objects/FulfillmentService): FulfillmentService Name of the service provider that fulfills from this location. * [fulfillsOnlineOrders](/docs/api/admin-graphql/unstable/scalars/Boolean): Boolean! Whether this location can fulfill online orders. * [hasActiveInventory](/docs/api/admin-graphql/unstable/scalars/Boolean): Boolean! Whether this location has active inventory. * [hasUnfulfilledOrders](/docs/api/admin-graphql/unstable/scalars/Boolean): Boolean! Whether this location has orders that need to be fulfilled. * [id](/docs/api/admin-graphql/unstable/scalars/ID): ID! A globally-unique ID. * [inventoryLevel](/docs/api/admin-graphql/unstable/objects/InventoryLevel): InventoryLevel The quantities of an inventory item at this location. * [isActive](/docs/api/admin-graphql/unstable/scalars/Boolean): Boolean! Whether the location is active. A deactivated location can be activated (change `isActive: true`) if it has `activatable` set to `true` by calling the [`locationActivate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/locationActivate) mutation. * [isFulfillmentService](/docs/api/admin-graphql/unstable/scalars/Boolean): Boolean! Whether this location is a fulfillment service. * [isPrimary](/docs/api/admin-graphql/unstable/scalars/Boolean): Boolean! Whether the location is your primary location for shipping inventory. * [legacyResourceId](/docs/api/admin-graphql/unstable/scalars/UnsignedInt64): UnsignedInt64! The ID of the corresponding resource in the REST Admin API. * [localPickupSettingsV2](/docs/api/admin-graphql/unstable/objects/DeliveryLocalPickupSettings): DeliveryLocalPickupSettings Local pickup settings for the location. * [metafield](/docs/api/admin-graphql/unstable/objects/Metafield): Metafield A [custom field](https://shopify.dev/docs/apps/build/custom-data), including its `namespace` and `key`, that's associated with a Shopify resource for the purposes of adding and storing additional information. * [metafieldsByIdentifiers](/docs/api/admin-graphql/unstable/objects/Metafield): Metafield! The metafields associated with the resource matching the supplied list of namespaces and keys. * [name](/docs/api/admin-graphql/unstable/scalars/String): String! The name of the location. * [shipsInventory](/docs/api/admin-graphql/unstable/scalars/Boolean): Boolean! Whether this location is used for calculating shipping rates. In multi-origin shipping mode, this flag is ignored. * [suggestedAddresses](/docs/api/admin-graphql/unstable/objects/LocationSuggestedAddress): LocationSuggestedAddress! List of suggested addresses for this location (empty if none). * [updatedAt](/docs/api/admin-graphql/unstable/scalars/DateTime): DateTime! The date and time ([ISO 8601 format](http://en.wikipedia.org/wiki/ISO_8601)) when the location was last updated. ## Examples ### Get a metafield attached to a location Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { location(id: $ownerId) { hours: metafield(namespace: $namespace, key: $key) { value } } }\",\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"hours\",\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\": `query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n location(id: $ownerId) {\n hours: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"hours\",\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 query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n location(id: $ownerId) {\n hours: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }\nQUERY\n\nvariables = {\n \"namespace\": \"my_fields\",\n \"key\": \"hours\",\n \"ownerId\": \"gid://shopify/Location/346779380\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n location(id: $ownerId) {\n hours: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n {\n variables: {\n \"namespace\": \"my_fields\",\n \"key\": \"hours\",\n \"ownerId\": \"gid://shopify/Location/346779380\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n location(id: $ownerId) {\n hours: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n}" #### Graphql Input { "namespace": "my_fields", "key": "hours", "ownerId": "gid://shopify/Location/346779380" } #### Graphql Response { "data": { "location": { "hours": { "value": "Open daily 9AM-5PM" } } } } ### Get metafields attached to a location Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query LocationMetafields($ownerId: ID!) { location(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }\",\n \"variables\": {\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\": `query LocationMetafields($ownerId: ID!) {\n location(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n \"variables\": {\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 query LocationMetafields($ownerId: ID!) {\n location(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"ownerId\": \"gid://shopify/Location/346779380\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query LocationMetafields($ownerId: ID!) {\n location(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"ownerId\": \"gid://shopify/Location/346779380\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query LocationMetafields($ownerId: ID!) {\n location(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n}" #### Graphql Input { "ownerId": "gid://shopify/Location/346779380" } #### Graphql Response { "data": { "location": { "metafields": { "edges": [ { "node": { "namespace": "my_fields", "key": "hours", "value": "Open daily 9AM-5PM" } } ] } } } } ### Get pinned metafield definitions associated with a location Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query LocationMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) { location(id: $ownerId) { metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) { edges { node { name namespace key type { name } } } } } }\",\n \"variables\": {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Location/346779380\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query LocationMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n location(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Location/346779380\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\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 query LocationMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n location(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Location/346779380\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query LocationMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n location(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Location/346779380\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query LocationMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n location(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n}" #### Graphql Input { "pinnedStatus": "PINNED", "ownerId": "gid://shopify/Location/346779380", "first": 10, "sortKey": "PINNED_POSITION" } #### Graphql Response { "data": { "location": { "metafieldDefinitions": { "edges": [ { "node": { "name": "Additional Notes", "namespace": "my_fields", "key": "notes", "type": { "name": "single_line_text_field" } } }, { "node": { "name": "Operating Since", "namespace": "my_fields", "key": "operating_since", "type": { "name": "date" } } } ] } } } } ### Retrieve a list of inventory levels for a location Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query LocationInventoryLevelList($id: ID!) { location(id: $id) { inventoryLevels(first: 10) { nodes { item { id } location { id } quantities(names: [\\\"available\\\"]) { name quantity } } } } }\",\n \"variables\": {\n \"id\": \"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\": `query LocationInventoryLevelList($id: ID!) {\n location(id: $id) {\n inventoryLevels(first: 10) {\n nodes {\n item {\n id\n }\n location {\n id\n }\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"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 query LocationInventoryLevelList($id: ID!) {\n location(id: $id) {\n inventoryLevels(first: 10) {\n nodes {\n item {\n id\n }\n location {\n id\n }\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Location/346779380\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query LocationInventoryLevelList($id: ID!) {\n location(id: $id) {\n inventoryLevels(first: 10) {\n nodes {\n item {\n id\n }\n location {\n id\n }\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Location/346779380\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query LocationInventoryLevelList($id: ID!) {\n location(id: $id) {\n inventoryLevels(first: 10) {\n nodes {\n item {\n id\n }\n location {\n id\n }\n quantities(names: [\"available\"]) {\n name\n quantity\n }\n }\n }\n }\n}" #### Graphql Input { "id": "gid://shopify/Location/346779380" } #### Graphql Response { "data": { "location": { "inventoryLevels": { "nodes": [ { "item": { "id": "gid://shopify/InventoryItem/113711323" }, "location": { "id": "gid://shopify/Location/346779380" }, "quantities": [ { "name": "available", "quantity": 8 } ] }, { "item": { "id": "gid://shopify/InventoryItem/30322695" }, "location": { "id": "gid://shopify/Location/346779380" }, "quantities": [ { "name": "available", "quantity": 2 } ] } ] } } } } ### Retrieve a single location by its ID Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query LocationShow($id: ID!) { location(id: $id) { id name fulfillmentService { handle } address { address1 address2 city country countryCode province provinceCode zip } fulfillsOnlineOrders hasActiveInventory isActive } }\",\n \"variables\": {\n \"id\": \"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\": `query LocationShow($id: ID!) {\n location(id: $id) {\n id\n name\n fulfillmentService {\n handle\n }\n address {\n address1\n address2\n city\n country\n countryCode\n province\n provinceCode\n zip\n }\n fulfillsOnlineOrders\n hasActiveInventory\n isActive\n }\n }`,\n \"variables\": {\n \"id\": \"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 query LocationShow($id: ID!) {\n location(id: $id) {\n id\n name\n fulfillmentService {\n handle\n }\n address {\n address1\n address2\n city\n country\n countryCode\n province\n provinceCode\n zip\n }\n fulfillsOnlineOrders\n hasActiveInventory\n isActive\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Location/346779380\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query LocationShow($id: ID!) {\n location(id: $id) {\n id\n name\n fulfillmentService {\n handle\n }\n address {\n address1\n address2\n city\n country\n countryCode\n province\n provinceCode\n zip\n }\n fulfillsOnlineOrders\n hasActiveInventory\n isActive\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Location/346779380\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query LocationShow($id: ID!) {\n location(id: $id) {\n id\n name\n fulfillmentService {\n handle\n }\n address {\n address1\n address2\n city\n country\n countryCode\n province\n provinceCode\n zip\n }\n fulfillsOnlineOrders\n hasActiveInventory\n isActive\n }\n}" #### Graphql Input { "id": "gid://shopify/Location/346779380" } #### Graphql Response { "data": { "location": { "id": "gid://shopify/Location/346779380", "name": "Ottawa Store", "fulfillmentService": null, "address": { "address1": "126 york street", "address2": "second and third floor", "city": "ottawa", "country": "Canada", "countryCode": "CA", "province": "Ontario", "provinceCode": "ON", "zip": "k1n5t5" }, "fulfillsOnlineOrders": true, "hasActiveInventory": true, "isActive": true } } } ### Returns a Location resource by ID Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { location(id: \\\"gid://shopify/Location/346779380\\\") { id name address { formatted } deactivatable fulfillsOnlineOrders hasActiveInventory isActive shipsInventory } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n location(id: \"gid://shopify/Location/346779380\") {\n id\n name\n address {\n formatted\n }\n deactivatable\n fulfillsOnlineOrders\n hasActiveInventory\n isActive\n shipsInventory\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 query {\n location(id: \"gid://shopify/Location/346779380\") {\n id\n name\n address {\n formatted\n }\n deactivatable\n fulfillsOnlineOrders\n hasActiveInventory\n isActive\n shipsInventory\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 query {\n location(id: \"gid://shopify/Location/346779380\") {\n id\n name\n address {\n formatted\n }\n deactivatable\n fulfillsOnlineOrders\n hasActiveInventory\n isActive\n shipsInventory\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n location(id: \"gid://shopify/Location/346779380\") {\n id\n name\n address {\n formatted\n }\n deactivatable\n fulfillsOnlineOrders\n hasActiveInventory\n isActive\n shipsInventory\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "location": { "id": "gid://shopify/Location/346779380", "name": "Ottawa Store", "address": { "formatted": [ "126 york street", "second and third floor", "ottawa ON k1n5t5", "Canada" ] }, "deactivatable": true, "fulfillsOnlineOrders": true, "hasActiveInventory": true, "isActive": true, "shipsInventory": false } } }