What is a mini cart? The cart in a shop's header

Published , by the PrintBlob team.

A mini cart is the small version of the shopping cart that sits in a shop’s header: an icon with a count of items that opens a drawer, a dropdown or a side panel listing what is in the cart, with links to the cart and checkout. The customer sees what they have added without leaving the page they are on.

Most shop themes have one. It is the first thing a customer looks at after pressing Add to cart, so a mini cart that does not update makes them think the add failed, and some press the button again.

The kinds of mini cart

  • A count on a cart icon. The simplest: the number of items next to a bag or basket.
  • A dropdown. Hovering over or clicking the icon shows the items under it.
  • A drawer or side cart. A panel slides in from the side after every add, with the items, the subtotal and buttons to the cart and checkout. Many shops use it to suggest something to add before checkout.

Where it gets its contents

A mini cart shows what the server says the cart holds, so it has to be told when that changes.

  • In WooCommerce’s classic themes and page builders, the mini cart is made of cart fragments: pieces of HTML WooCommerce sends after an Ajax add to cart, which replace the old ones on the page. Its drawer usually opens on WooCommerce’s added_to_cart event.
  • In WooCommerce’s block themes, the Mini-Cart block reads the cart through the Store API and refreshes on an event of its own; it also hears added_to_cart.
  • In Shopify themes, the theme’s own product form adds to the cart, and the theme’s script updates its cart drawer from Shopify’s cart.

When the count stays at 0

The usual cause is an add the mini cart was not told about: a button that adds to the cart in its own way and does not send the signal the theme listens to. A reload shows the item, because the page is built afresh from the cart. The fix belongs in whatever added the item: it should send what the platform’s own Add to cart sends.

In PrintBlob

PrintBlob’s designer updates WooCommerce mini carts of both kinds since version 1.7.1, and on Shopify the theme’s own Add to cart adds the design, so the theme’s cart drawer follows as it does for any product. More on the checks in product designer problems in WooCommerce themes.

Sources