GraphQL Storefront API
BigCommerce’s GraphQL Storefront API lets frontend developers retrieve products from a store. These built-in capabilities allow developers to customize their hosted and headless storefronts with product information.
The GraphQL Storefront API lets you retrieve the following product attributes and more:
You can access these attributes for a product if a merchant makes a product visible on storefronts.
This guide walks you through the process of retrieving information for a product. If your product has variants, see Guide to Working with Product Variants on how to retrieve variant information. For full schema documentation, see the GraphQL Storefront Playground.
International Enhancements for Multi-Storefront allows some product features to have overrides in a storefront channel locale. For these features, the GraphQL Storefront API can return the global store value that the storefront inherits, or the override for the channel’s locale, depending on storefront settings. For a full list of product fields, see the International Enhancements for Multi-Storefront overview.
You can query a product by using the product field and specifying a product identifier, for example, the product entityId.
The Product object is also used to retrieve variant information. For example, if you use the identifier variantEntityId or optionValueIds, you will retrieve information for the variant overlaid on the Product object (if the variant has a different values than the product).
See Get a variant for more information.
Query a list of products by using the products field and specifying product identifiers, for example, the product entityIDs:
Query all products by not including an argument for products.
You can also query for featured products, related products, and more. See the GraphQL Storefront Playground for full schema documentation.
Query basic information for products. The following query retrieves both product identifiers and basic information for the specified product:
Query prices and dimensions for a product. The following query retrieves prices and dimensions for the specified product:
Query the product options associated with a product. The response includes both variant options and modifier options. To retrieve only variant options, use a Get variant options query.
There are various types of product options available. Checkbox and multiple choice are some examples of the many option types available. Each type of product option has a schema type that implements the CatalogProductOption interface, meaning you can retrieve the common fields from CatalogProductOption for any type of product option. For more on interfaces, see the GraphQL Schema and Types- Interfaces (graphql.org) documentation.
The following example shows how to get the first three product options associated with a product. In the response, all product options include queried fields from the CatalogProductOption interface, and those that are checkbox or datefields include additional fields.
When you get product options, you can retrieve the available values, or product option values, for product options that are multiple choice (Help Center). These values are made up of various types, swatch or radio buttons, for example. Each type of multiple choice value has a schema type that implements the CatalogProductOptionValue interface, meaning you can retrieve the common fields from CatalogProductOptionValue for any type of multiple choice value.
The following example shows a query that includes values for product options that are multiple choice. In the response, all product option values include queried fields from the CatalogProductOptionValue interface, and product option values that are swatch types include additional fields. The example query retrieves only the first product option and the first two values for that product option.
Query the images for products. Note that the default image is a thumbnail for the product.
The following example retrieves the first two images and the default image for the specified product:
You can query product images at different resolutions. The following query retrieves the first image for the specified product at various resolutions:
The following example retrieves video titles and URLs associated with videos attached to a product.
Query product metafields by specifying the product metafield’s namespace. The API returns only metafields that have storefront permissions. Permissions must be set to write_and_sf_access or read_and_sf_access. To set permissions, use the Update a product metafield endpoint.
The query retrieves only product metafields. To retrieve variant metafields, see Get variant metafields.
The following query retrieves the first two product metafields for the specified product:
Query the custom fields for products. The following example retrieves the first two custom fields for the specified product:
Query gift wrapping options that are available for a product. The following example retrieves the first two gift wrapping options for the specified product:
Query condition information for a product. Possible values are "NEW", "USED", "REFURBISHED", and null. If the option to show product condition is disabled, the expected return value is null. The following example retrieves the condition for the specified product:
Query reviews for products. You retrieve only reviews that a merchant has approved. The following example retrieves the first review for the specified product: