What is the GraphQL Storefront API?
GraphQL Storefront API
BigCommerce’s GraphQL Storefront API makes it possible to query storefront data from within a Stencil theme or a headless storefront. This means you can use GraphQL to expand the objects in the Stencil context or make front-end calls from any storefront, including headless storefronts.
It allows you to get shopper data from the perspective of a customer in a channel - that means their pricing, product availability, etc. If you’ve hidden a product on the basis of channel or customer group, that is automatically reflected in the API and you can get all that information in one API call.
Who Should Be Interested in GraphQL Storefront API?
- Developers building custom themes to deliver a particular brand’s vision and create a distinct customer/shopper experience.
- Developers building an application that needs to retrieve pricing data in the context of a specific customer.
- Developers that need to retrieve and display customer or catalog data on a headless site.
Why is GraphQL Storefront API Important?
By leveraging the power of GraphQL, data for multiple resources can be returned from a single API call. This simplifies integration and increases performance to allow developers to focus on building delightful shopper experiences.
Below are just a few characteristics of a GraphQL Storefront API:
- Fast - Get all the information you need in a single API call with faster response time, minimized requests, and less complexity.
- Personalized - Return “my version” of the information. Create a personalized Product Listing Page with special products for VIP customers. The GraphQL Storefront API always returns information from the perspective of the active shopper, including all BigCommerce features that affect their experience (ex. Price Lists).
- Branded - Achieve a merchant’s brand vision and create shopper experiences without being limited to specific technology choices. No more compromises if you want to use a technology other than Stencil.
- Frictionless - Freedom to redefine the purchase funnel and diverge from the standard look and feel of the storefront if you have a better idea of how your business should run.
- Secure, but flexible - Great security model with the flexibility to use wherever necessary. You can use it on the front-end of a website or the back-end without being restricted due to the security model.
What Can You Do with GraphQL Storefront API?
With the GraphQL Storefront API, it is possible to:
- Access product options, variations, and custom fields for any product from any page.
- Request any product’s images at any resolution.
- Perform a filtered product search.
- Log in a customer.
- Ask for customer details such as name, email address, and attributes (if logged in).
- Look up objects (e.g., categories or brands) by URL and fetch their details.
- Query and manage a cart and checkout.
- Get real-time storefront data from the perspective of a customer and channel, such as customer-specific pricing in the shopper’s currency and product availability.
- Get everything in one API call with an efficient GraphQL architecture.
- Fetch metafields created by REST APIs.
- Manage customer logins.
- Query URLs, metafields, and more on your storefront.
GraphQL Use Cases
- Powerful CMS integrations.
- Power non-web shopper experiences, such as mobile apps.
- Run multiple headless storefronts or other sales channels using a single BigCommerce store.
- Create custom shopping experiences for different market segments or customer types.
- Create microsites to highlight specific product lines.
GraphQL-Powered Storefronts
The GraphQL Storefront API is a key tool for any BigCommerce-powered storefront, whatever platform that storefront is built on.
- BigCommerce Storefronts - Integrated storefronts built with the Stencil templating language can incorporate queries to the GraphQL Storefront API to power enhanced features, making data accessible anywhere.
- Headless Storefronts - GraphQL is the most flexible and performant way for headless storefronts to interact with BigCommerce.
Use Case:
In the Developer Blog article linked below, learn about the many possibilities of GraphQL and BigCommerce.
Introduction to GraphQL & BigCommerce
Companies like Airbnb, The New York Times, and Yelp all use the GraphQL query language to get server-side data they need to power their front ends. GraphQL has grown steadily in popularity since its creation at Facebook in 2012 , but adoption really took off when it went open source in 2015.
