--- title: location - GraphQL Admin description: Returns an inventory Location resource by ID. api_version: 2025-10 api_name: admin type: query api_type: graphql source_url: html: 'https://shopify.dev/docs/api/admin-graphql/latest/queries/location' md: 'https://shopify.dev/docs/api/admin-graphql/latest/queries/location.md' --- # location query Returns an inventory Location resource by ID. ## Arguments * id [ID](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID) The ID of the location to return. If no ID is provided, the primary location of the Shop is returned. *** ## Possible returns * Location [Location](https://shopify.dev/docs/api/admin-graphql/latest/objects/Location) Represents the location where the physical good resides. You can stock inventory at active locations. Active locations that have `fulfills_online_orders: true` and are configured with a shipping rate, pickup enabled or local delivery will be able to sell from their storefront. * activatable [Boolean!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) non-null 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 [Location​Address!](https://shopify.dev/docs/api/admin-graphql/latest/objects/LocationAddress) non-null The address of this location. * address​Verified [Boolean!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) non-null Whether the location address has been verified. * created​At [Date​Time!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/DateTime) non-null The date and time ([ISO 8601 format](http://en.wikipedia.org/wiki/ISO_8601)) that the location was added to a shop. * deactivatable [Boolean!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) non-null 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. * deactivated​At [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/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 [Boolean!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) non-null Whether this location can be deleted. * fulfillment​Service [Fulfillment​Service](https://shopify.dev/docs/api/admin-graphql/latest/objects/FulfillmentService) Name of the service provider that fulfills from this location. * fulfills​Online​Orders [Boolean!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) non-null Whether this location can fulfill online orders. * has​Active​Inventory [Boolean!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) non-null Whether this location has active inventory. * has​Unfulfilled​Orders [Boolean!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) non-null Whether this location has orders that need to be fulfilled. * id [ID!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID) non-null A globally-unique ID. * inventory​Level [Inventory​Level](https://shopify.dev/docs/api/admin-graphql/latest/objects/InventoryLevel) The quantities of an inventory item at this location. * inventory​Item​Id [ID!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID) required ### Arguments The ID of the inventory item to obtain the inventory level for. *** * inventory​Levels [Inventory​Level​Connection!](https://shopify.dev/docs/api/admin-graphql/latest/connections/InventoryLevelConnection) non-null A list of the quantities of the inventory items that can be stocked at this location. * first [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int) ### Arguments The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * after [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * last [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int) The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * before [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * reverse [Boolean](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) Default:false Reverse the order of the underlying list. * query [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax). * created\_at time * * id id * inventory\_group\_id id - Filter by `id` range. - Example: * `id:1234` * `id:>=1234` * `id:<=1234` * inventory\_item\_id id * updated\_at time *** * is​Active [Boolean!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) non-null 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. * is​Fulfillment​Service [Boolean!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) non-null Whether this location is a fulfillment service. * legacy​Resource​Id [Unsigned​Int64!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/UnsignedInt64) non-null The ID of the corresponding resource in the REST Admin API. * local​Pickup​Settings​V2 [Delivery​Local​Pickup​Settings](https://shopify.dev/docs/api/admin-graphql/latest/objects/DeliveryLocalPickupSettings) Local pickup settings for the location. * metafield [Metafield](https://shopify.dev/docs/api/admin-graphql/latest/objects/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. * namespace [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) ### Arguments The container the metafield belongs to. If omitted, the app-reserved namespace will be used. * key [String!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) required The key for the metafield. *** * metafields [Metafield​Connection!](https://shopify.dev/docs/api/admin-graphql/latest/connections/MetafieldConnection) non-null A list of [custom fields](https://shopify.dev/docs/apps/build/custom-data) that a merchant associates with a Shopify resource. * namespace [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) ### Arguments The metafield namespace to filter by. If omitted, the app-reserved namespace will be used. * keys [\[String!\]](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) List of keys of metafields in the format `namespace.key`, will be returned in the same format. * first [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int) The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * after [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * last [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int) The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * before [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * reverse [Boolean](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) Default:false Reverse the order of the underlying list. *** * name [String!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) non-null The name of the location. * ships​Inventory [Boolean!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) non-null Whether this location is used for calculating shipping rates. In multi-origin shipping mode, this flag is ignored. * suggested​Addresses [\[Location​Suggested​Address!\]!](https://shopify.dev/docs/api/admin-graphql/latest/objects/LocationSuggestedAddress) non-null List of suggested addresses for this location (empty if none). * updated​At [Date​Time!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/DateTime) non-null The date and time ([ISO 8601 format](http://en.wikipedia.org/wiki/ISO_8601)) when the location was last updated. * is​Primary [Boolean!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) non-nullDeprecated * metafield​Definitions [Metafield​Definition​Connection!](https://shopify.dev/docs/api/admin-graphql/latest/connections/MetafieldDefinitionConnection) non-nullDeprecated * namespace [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) ### Arguments Filter metafield definitions by namespace. * pinned​Status [Metafield​Definition​Pinned​Status](https://shopify.dev/docs/api/admin-graphql/latest/enums/MetafieldDefinitionPinnedStatus) Default:ANY Filter by the definition's pinned status. * first [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int) The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * after [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * last [Int](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Int) The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * before [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * reverse [Boolean](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean) Default:false Reverse the order of the underlying list. * sort​Key [Metafield​Definition​Sort​Keys](https://shopify.dev/docs/api/admin-graphql/latest/enums/MetafieldDefinitionSortKeys) Default:ID Sort the underlying list using a key. If your query is slow or returns an error, then [try specifying a sort key that matches the field used in the search](https://shopify.dev/api/usage/pagination-graphql#search-performance-considerations). * query [String](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax). * * default string * created\_at time * id id * key string * namespace string * owner\_type string * type string * updated\_at time - Filter by a case-insensitive search of multiple fields in a document. - Example: * `query=Bob Norman` * `query=title:green hoodie` Filter by the date and time when the metafield definition was created. - Example: * `created_at:>2020-10-21T23:39:20Z` * `created_at:=1234` * `id:<=1234` Filter by the metafield definition [`key`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MetafieldDefinition#field-key) field. - Example: * `key:some-key` Filter by the metafield definition [`namespace`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MetafieldDefinition#field-namespace) field. - Example: * `namespace:some-namespace` Filter by the metafield definition [`ownerType`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MetafieldDefinition#field-ownertype) field. - Example: * `owner_type:PRODUCT` Filter by the metafield definition [`type`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MetafieldDefinition#field-type) field. - Example: * `type:single_line_text_field` Filter by the date and time when the metafield definition was last updated. Example: * `updated_at:>2020-10-21T23:39:20Z` * `updated_at: { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { location(id: $ownerId) { hours: metafield(namespace: $namespace, key: $key) { value } } }`, { variables: { "namespace": "my_fields", "key": "hours", "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 query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { location(id: $ownerId) { hours: metafield(namespace: $namespace, key: $key) { value } } } QUERY variables = { "namespace": "my_fields", "key": "hours", "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": `query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { location(id: $ownerId) { hours: metafield(namespace: $namespace, key: $key) { value } } }`, "variables": { "namespace": "my_fields", "key": "hours", "ownerId": "gid://shopify/Location/346779380" }, }, }); ``` #### Response ```json { "location": { "hours": { "value": "Open daily 9AM-5PM" } } } ``` * ### Get metafields attached to a location #### Description Get a page of metafields attached to a specific location. #### Query ```graphql query LocationMetafields($ownerId: ID!) { location(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } } ``` #### Variables ```json { "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": "query LocationMetafields($ownerId: ID!) { location(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }", "variables": { "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 query LocationMetafields($ownerId: ID!) { location(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }`, { variables: { "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 query LocationMetafields($ownerId: ID!) { location(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } } QUERY variables = { "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": `query LocationMetafields($ownerId: ID!) { location(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }`, "variables": { "ownerId": "gid://shopify/Location/346779380" }, }, }); ``` #### Response ```json { "location": { "metafields": { "edges": [ { "node": { "namespace": "my_fields", "key": "hours", "value": "Open daily 9AM-5PM" } } ] } } } ``` * ### Get pinned metafield definitions associated with a location #### Description Get names and types of the first page of pinned metafield definitions associated with a location. #### Query ```graphql 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 } } } } } } ``` #### Variables ```json { "pinnedStatus": "PINNED", "ownerId": "gid://shopify/Location/346779380", "first": 10, "sortKey": "PINNED_POSITION" } ``` #### 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": "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 } } } } } }", "variables": { "pinnedStatus": "PINNED", "ownerId": "gid://shopify/Location/346779380", "first": 10, "sortKey": "PINNED_POSITION" } }' ``` #### 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 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 } } } } } }`, { variables: { "pinnedStatus": "PINNED", "ownerId": "gid://shopify/Location/346779380", "first": 10, "sortKey": "PINNED_POSITION" }, }, ); 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 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 } } } } } } QUERY variables = { "pinnedStatus": "PINNED", "ownerId": "gid://shopify/Location/346779380", "first": 10, "sortKey": "PINNED_POSITION" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "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 } } } } } }`, "variables": { "pinnedStatus": "PINNED", "ownerId": "gid://shopify/Location/346779380", "first": 10, "sortKey": "PINNED_POSITION" }, }, }); ``` #### Response ```json { "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 #### Query ```graphql query LocationInventoryLevelList($id: ID!) { location(id: $id) { inventoryLevels(first: 10) { nodes { item { id } location { id } quantities(names: ["available"]) { name quantity } } } } } ``` #### Variables ```json { "id": "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": "query LocationInventoryLevelList($id: ID!) { location(id: $id) { inventoryLevels(first: 10) { nodes { item { id } location { id } quantities(names: [\"available\"]) { name quantity } } } } }", "variables": { "id": "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 query LocationInventoryLevelList($id: ID!) { location(id: $id) { inventoryLevels(first: 10) { nodes { item { id } location { id } quantities(names: ["available"]) { name quantity } } } } }`, { variables: { "id": "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 query LocationInventoryLevelList($id: ID!) { location(id: $id) { inventoryLevels(first: 10) { nodes { item { id } location { id } quantities(names: ["available"]) { name quantity } } } } } QUERY variables = { "id": "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": `query LocationInventoryLevelList($id: ID!) { location(id: $id) { inventoryLevels(first: 10) { nodes { item { id } location { id } quantities(names: ["available"]) { name quantity } } } } }`, "variables": { "id": "gid://shopify/Location/346779380" }, }, }); ``` #### Response ```json { "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 #### Query ```graphql query LocationShow($id: ID!) { location(id: $id) { id name fulfillmentService { handle } address { address1 address2 city country countryCode province provinceCode zip } fulfillsOnlineOrders hasActiveInventory isActive } } ``` #### Variables ```json { "id": "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": "query LocationShow($id: ID!) { location(id: $id) { id name fulfillmentService { handle } address { address1 address2 city country countryCode province provinceCode zip } fulfillsOnlineOrders hasActiveInventory isActive } }", "variables": { "id": "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 query LocationShow($id: ID!) { location(id: $id) { id name fulfillmentService { handle } address { address1 address2 city country countryCode province provinceCode zip } fulfillsOnlineOrders hasActiveInventory isActive } }`, { variables: { "id": "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 query LocationShow($id: ID!) { location(id: $id) { id name fulfillmentService { handle } address { address1 address2 city country countryCode province provinceCode zip } fulfillsOnlineOrders hasActiveInventory isActive } } QUERY variables = { "id": "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": `query LocationShow($id: ID!) { location(id: $id) { id name fulfillmentService { handle } address { address1 address2 city country countryCode province provinceCode zip } fulfillsOnlineOrders hasActiveInventory isActive } }`, "variables": { "id": "gid://shopify/Location/346779380" }, }, }); ``` #### Response ```json { "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 #### Description The following query retrieves the location with the associated ID. It returns the location fields specified in the query. #### Query ```graphql query { location(id: "gid://shopify/Location/346779380") { id name address { formatted } deactivatable fulfillsOnlineOrders hasActiveInventory isActive shipsInventory } } ``` #### 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": "query { location(id: \"gid://shopify/Location/346779380\") { id name address { formatted } deactivatable fulfillsOnlineOrders hasActiveInventory isActive shipsInventory } }" }' ``` #### 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 query { location(id: "gid://shopify/Location/346779380") { id name address { formatted } deactivatable fulfillsOnlineOrders hasActiveInventory isActive shipsInventory } }`, ); 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 query { location(id: "gid://shopify/Location/346779380") { id name address { formatted } deactivatable fulfillsOnlineOrders hasActiveInventory isActive shipsInventory } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { location(id: "gid://shopify/Location/346779380") { id name address { formatted } deactivatable fulfillsOnlineOrders hasActiveInventory isActive shipsInventory } }`, }); ``` #### Response ```json { "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 } } ``` [Open in GraphiQL](http://localhost:3457/graphiql?query=query%20LocationMetafield\(%24namespace%3A%20String!%2C%20%24key%3A%20String!%2C%20%24ownerId%3A%20ID!\)%20%7B%0A%20%20location\(id%3A%20%24ownerId\)%20%7B%0A%20%20%20%20hours%3A%20metafield\(namespace%3A%20%24namespace%2C%20key%3A%20%24key\)%20%7B%0A%20%20%20%20%20%20value%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22namespace%22%3A%20%22my_fields%22%2C%0A%20%20%22key%22%3A%20%22hours%22%2C%0A%20%20%22ownerId%22%3A%20%22gid%3A%2F%2Fshopify%2FLocation%2F346779380%22%0A%7D) ##### GQL ```graphql query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { location(id: $ownerId) { hours: metafield(namespace: $namespace, key: $key) { value } } } ``` ##### 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": "query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { location(id: $ownerId) { hours: metafield(namespace: $namespace, key: $key) { value } } }", "variables": { "namespace": "my_fields", "key": "hours", "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 query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { location(id: $ownerId) { hours: metafield(namespace: $namespace, key: $key) { value } } }`, { variables: { "namespace": "my_fields", "key": "hours", "ownerId": "gid://shopify/Location/346779380" }, }, ); const json = await response.json(); return json.data; } ``` ##### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { location(id: $ownerId) { hours: metafield(namespace: $namespace, key: $key) { value } } }`, "variables": { "namespace": "my_fields", "key": "hours", "ownerId": "gid://shopify/Location/346779380" }, }, }); ``` ##### 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 query LocationMetafield($namespace: String!, $key: String!, $ownerId: ID!) { location(id: $ownerId) { hours: metafield(namespace: $namespace, key: $key) { value } } } QUERY variables = { "namespace": "my_fields", "key": "hours", "ownerId": "gid://shopify/Location/346779380" } response = client.query(query: query, variables: variables) ``` ## Input variables JSON ```json { "namespace": "my_fields", "key": "hours", "ownerId": "gid://shopify/Location/346779380" } ``` ## Response JSON ```json { "location": { "hours": { "value": "Open daily 9AM-5PM" } } } ```