For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dev Portal
DocsAPI ReferenceLearnCommunityChangelog
DocsAPI ReferenceLearnCommunityChangelog
  • Overview
    • Quick Start
    • Sandboxes
    • Tools & SDKs
    • Support
  • Docs
      • Getting Started
      • Becoming a Partner
      • Metafields
      • Scripts
      • Shipping Providers
      • Tax Providers
          • Overview
            • Storefront
            • Add to cart
            • Checkout
            • Orders
          • Frequently asked questions
          • Glossary
          • Inventory adjustments
          • Locations
          • Webhooks
        • Analytics with BODL
        • Staging with Staging Pro
    • Archive
    • Closed Beta Programs
Dev Portal
LogoLogo
DocsIntegrationsPlatform SolutionsBuy online, pick up in storeIntegration guide

Adding Buy Online, Pick up in Store Features to the Storefront

Was this page helpful?
Previous

Retire merchant configuration

Next

Add to cart

Built with

You can enhance the storefront browsing experience by letting shoppers see and select a Pickup fulfillment method.

The biggest benefit is that shoppers can see product inventory availability by location. This helps inform their shopping decisions.

storefront browsing.png

Adding inventory data experiences can be achieved by customizing a store’s theme to query the GraphQL Storefront API and display the appropriate components for availability.

The Query Locations with the GraphQL Storefront API and Query Inventory with the GraphQL Storefront API pages contain info about what has been added to the API to support Buy Online, Pick up in Store features.

The following example shows how you can show inventory for the base product and its variants using Stencil:

  1. Add the following GraphQL attribute to the Stencil Front Matter of the product.html page:
gql: "query($productId: Int!) {
site {
product(entityId: $productId) {
name
inventory {
aggregated {
availableToSell
}
}
variants {
edges {
node {
sku
inventory {
aggregated {
availableToSell
}
byLocation {
edges {
node {
locationEntityCode
availableToSell
isInStock
}
}
}
}
}
}
}
}
}
}"
  1. Add the following handlebars to the product-view.html page:
{{#if gql.data.site.product}}
<b>Available to Sell:</b> {{gql.data.site.product.inventory.aggregated.availableToSell}} <br />
{{#each gql.data.site.product.variants.edges}}
{{#with node}}
<b>Variant SKU: </b> {{sku}} <br />
Total Available to Sell: {{inventory.aggregated.availableToSell}} <br />
{{#each inventory.byLocation.edges}}
{{#with node}}
{{#if isInStock}}
{{locationEntityCode}} has {{availableToSell}} in stock <br />
{{/if}}
{{/with}}
{{/each}}
{{/with}}
{{/each}}
{{/if}}