Configure the Minicart rendering

Version: 9.2

You use the Minicart rendering on, for example, the catalog and product pages to display a summary of the contents of the shopping cart. You can configure how the minicart behaves and how it renders on the page.

The Minicart rendering

Enable the minicart count cache

The Minicart rendering only needs the cart count initially as it is rendered on the page and only when the customer hovers above the minicart or clicks on it does it need to render the content of the cart. Since the Minicart rendering appears on most storefront pages, it reduces the number of calls to the server if the cart count is cached. A boolean setting determines whether to cache the cart count on the client side to reduce the number of server-side calls to retrieve the cart. Fewer calls means better performance on both the server and client side. By default, this setting is enabled.

The cart count is stored in the client session storage so it is cleared every time the browser is closed. Turning the storage off presents the same privacy concerns as is the case when using cookies.

Note

Older versions of browsers may encounter issues when the minicart count cache is enabled. It is a business decision based on market and target audience whether to turn on caching based on the client session storage.

When a customer updates, adds items to, or removes items from the cart, the cart count is updated. When you disable the minicart count caching feature, a GetCartLinesCount API call is made to the server each time the rendering is processed and this can affect performance.

When the customer first sees the minicart, the cart count is retrieved using the GetCartLinesCount API and saved as a session storage object in the browser cache under the key cxaCartCount. When the customer interacts with the minicart at any time during the same session, Sitecore retrieves the cart count from the browser cache.

Important

Sitecore deletes the cached minicart count during the customer login and logout processes.

To enable the minicart count cache:

  1. On the Sitecore Launchpad, click Content Editor.

  2. In the content tree, navigate to sitecore/Content/Sitecore/Storefront/Settings/Commerce/Cart Configuration.

    The Cache Cart Count check box in the Cart Configuration item
  3. Click the Cache Cart Count check box.

  4. To save your changes, on the Home tab, click Save.

  5. After you have made your changes, republish the site. On the ribbon, on the Publish tab, click Publish, Publish Site and then, in the Publish Site dialog box, click Republish to republish the entire site in all supported languages.

    Note

    Do not click Smart Publish or Incremental Publish because, with these options, only changed items are updated.

Disable recalculation of the minicart

The Minicart rendering with recalculation enabled means that the cart is automatically recalculated on the server side when a customer hovers over the minicart to see a summary of the contents of the shopping cart.

To improve the time it takes to display the minicart when the cart contains many items, you can configure the Minicart rendering so that cart contents are not recalculated when displayed by a customer.

Important

Do not disable minicart recalculation if promotions are being used on a minute-by-minute basis. By default, the recalculation setting is enabled. It is a business decision whether to disallow promotions on a minute-by-minute basis and, hence, disable recalculation of the cart to improve performance.

To disable recalculation of the minicart:

  1. On the Sitecore Launchpad, click Content Editor.

  2. In the Content Editor, navigate to sitecore/Content/<tenant>/<site>/Settings/Commerce and click the Cart Configuration item.

    The Cart Configuration item
  3. On the Content tab, in the Performance section, clear the Server-Side Minicart Recalculation check box.

  4. To save your changes, on the Home tab, click Save.

  5. After you have made your changes, republish the site. On the ribbon, on the Publish tab, click Publish, Publish Site and then, in the Publish Site dialog box, click Republish to republish the entire site in all supported languages.

    Note

    Do not click Smart Publish or Incremental Publish because, with these options, only changed items are updated.

Do you have some feedback for us?

If you have suggestions for improving this article,