Build product listing pages

This is for:

Developer
Important

Atomic for Commerce components are in open beta and remain under active development.

Atomic for Commerce hasn’t yet gone through a formal accessibility review. If you have accessibility needs, contact your customer success manager and we’ll work with you to address them.

All product listing pages (PLPs) in Atomic use the atomic-commerce-product-list component to fetch product listings and display the products.

It must be placed inside a atomic-commerce-interface with the type attribute set to product-listing.

Prerequisite

Make sure that you understand how to build product listing pages (PLPs).

Code Sample

Following is a minimal example of a product listing page built with Atomic for Commerce. This uses getSampleCommerceEngineConfiguration from @coveo/headless/commerce for its configuration. This won’t work in a production environment.

For a detailed breakdown of how to configure your product listing interface, refer to the Coveo Headless documentation for CommerceEngineConfiguration.

<html>
  <head>
    <title>Example Product Listing Page</title>
      <script
          type="module"
          src="https://static.cloud.coveo.com/atomic/v3/atomic.esm.js"> 1
      </script>
      <link
          rel="stylesheet"
          href="https://static.cloud.coveo.com/atomic/v3/themes/coveo.css"/> 2
    <script type="module">
      (async () => {
        const {
          getSampleCommerceEngineConfiguration
        } = await import('http://static.cloud.coveo.com/headless/v3/commerce/headless.esm.js'); 3

        await customElements.whenDefined('atomic-commerce-interface');
        const commerceInterface = document.querySelector('atomic-commerce-interface');
        await commerceInterface.initialize(getSampleCommerceEngineConfiguration()); 4
        commerceInterface.executeFirstRequest();
      })();
    </script>
  </head>
  <body>
    <atomic-commerce-interface analytics language="en" reflect-state-in-url type="product-listing">
      <atomic-commerce-product-list number-of-placeholders="4"></atomic-commerce-product-list> 5
    </atomic-commerce-interface>
  </body>
</html>
1 Import the Atomic for library. This is responsible for handling the web components.
2 Link the Coveo theme stylesheet. This provides the default styling for the web components.
3 Import the Headless for Commerce library to get the sample configuration. When providing your own configuration you won’t need to import this function.
4 Initialize the atomic-commerce-interface.
5 The product list page for the interface. For additional options refer to Product listing page components.

You can find a complete example of a product listing page in Storybook.

Product listing page components

A product listing page typically consists of a list of products, as well as components to filter and navigate the products. Here is a list of useful Atomic components that can be added to a product listing page:

Note

The atomic-commerce-pager and atomic-commerce-load-more-products components can’t be used together.