You can display whether a product is in stock and available for local pickup using the [Storefront API](/docs/api/storefront). Customers can then pick up their online orders at a retail store, a curbside pickup location, or any location that a merchant chooses. This guide shows you how to support local pickup on a custom storefront. ## Requirements - You've completed the [Getting started with the Storefront API](/docs/storefronts/headless/building-with-the-storefront-api/getting-started) guide. - You're familiar with [querying products and collections](/docs/storefronts/headless/building-with-the-storefront-api/products-collections/getting-started). - You've created [products](/docs/api/admin-graphql/latest/objects/product) and [variants](/docs/api/admin-graphql/latest/objects/productvariant) in your store. - You've [enabled local pickup](https://help.shopify.com/en/manual/shipping/setting-up-and-managing-your-shipping/local-methods/local-pickup) for one or more of your locations. - Your Headless channel or custom app has the `unauthenticated_read_product_pickup_locations` [access scopes](/docs/api/usage/access-scopes). Learn how to [request permissions for Headless channels](/docs/storefronts/headless/building-with-the-storefront-api/manage-headless-channels#request-storefront-permissions). ## Step 1: Determine pickup availability for a product variant When a user selects a particular product variant, you can query for its in-store pickup availability. Within the [`storeAvailability`](/docs/api/storefront/latest/objects/StoreAvailability) object, you can query whether a variant is in stock at a location (`available`), the location where the variant is stocked (`location`), and the estimated amount of time that it takes for the pickup to be ready (`pickUpTime`). The response includes a list of pickup locations that are sorted alphabetically by city and location name.

## Step 2: Retrieve in-store pickup locations You might want to show customers a list of available locations so that they can establish a preferred one for future queries. To retrieve this list, you can use the [`locations`](/docs/api/storefront/latest/queries/locations) query. If you want to sort the results based on proximity to the customer's current location, then you can also pass a `near` argument that contains a latitude and longitude value.

## Step 3: Use the customer's preferred location By default, [`storeAvailability`](/docs/api/storefront/latest/objects/StoreAvailability) objects are sorted by city and name. To sort them by proximity to the customer's preferred location, you can pass a location ID using the `preferredLocationId` argument of the `@inContext` directive.

## Next steps - Learn how to [create and update a cart](/docs/storefronts/headless/building-with-the-storefront-api/cart/manage) in Shopify with the Storefront API. - Learn how to [manage customer accounts](/docs/storefronts/headless/building-with-the-customer-account-api/customer-accounts) with the Storefront API. - Support [multiple languages](/docs/storefronts/headless/building-with-the-storefront-api/markets/multiple-languages) on a custom storefront with the Storefront API. - Learn about the [different tools](/docs/storefronts/headless/additional-sdks) that you can use to create unique buying experiences anywhere your customers are, including websites, apps, and video games.