How to add brackets displaying the number of items in the cart

Topic summary

A user wants to display the number of cart items in brackets next to cart text (e.g., “Cart (0)” or “Cart (2)”) in the Dawn theme, having already replaced the default cart icon with text.

Solution provided:

  • Use the Liquid variable {{ cart.item_count }} to dynamically retrieve the number of items in the cart
  • Modify the cart text code in the theme files (typically found in header.liquid or similar template files)
  • Example implementation: <a href="/cart" class="cart">Cart ({{ cart.item_count }})</a>

Steps:

  1. Navigate to Online Store > Themes > Edit code
  2. Locate the template file controlling the cart display
  3. Insert the {{ cart.item_count }} variable within the cart text markup
  4. Save changes

The variable will automatically update the displayed count as items are added or removed from the cart.

Summarized with AI on November 9. AI used: claude-sonnet-4-5-20250929.

Hello community!

Using the dawn theme. I have previously replaced the cart icon with text. Now, I would like to have brackets displaying the number of items in the cart next to the text. Examples = Cart (0) or Cart (2)

Attached is an example of a website using this design.

Thank you very much!

You can call {{ cart.item_count }} to get the number of items in the cart.

Hi @MagdalenaBB ,
This is Theodore from PageFly - Shopify Page Builder App.

To display the cart text with item count in your Dawn theme:

  1. Edit your theme code (Online Store > Themes > Edit code).
  2. Find the template file controlling the cart icon/text (e.g., cart.liquid or header.liquid).
  3. Modify the cart text code (e.g., Cart ({{ cart.item_count }})).
  4. Save changes.

This injects the {{ cart.item_count }} variable to dynamically update the cart item count next to the text.

Best regards,
Theodore | PageFly

1 Like