The Ezz Cart Count extension allows you to display product and variant quantities in your cart directly on your product page. This guide will walk you through how to add the extension to your Liquid templates, customize the display messages, and style the cart count widget.

  1. Product Count Extension To display the cart count for a product, you need to add the following code to your product.liquid or any template that renders product information:
<ezz-cart-count
  source-type="product"
  source-id="{{ product.id }}"
  hide-when-zero
  style="--ezz-margin: {{ margin_value }}; --ezz-padding: {{ padding_value }}; --ezz-font-size: {{ font_size }}px; --ezz-text-color: {{ text_color }}; --ezz-bg-color: {{ background_color }}; --ezz-border-radius: {{ border_radius }}px"
>
  <span data-ezz-cart-count-singular>
    {{ '[[COUNT]] item in your cart' | replace: '[[COUNT]]', '<span data-ezz-cart-count></span>' }}
  </span>
  <span data-ezz-cart-count-plural>
    {{ '[[COUNT]] items in your cart' | replace: '[[COUNT]]', '<span data-ezz-cart-count></span>' }}
  </span>
</ezz-cart-count>

Explanation of the Code:


Variant Count Extension To display the cart count for a specific variant of a product, add the following code in your product.liquid template or any template that shows variant information:

<ezz-cart-count
  source-type="variant"
  product-id="{{ product.id }}"
  source-id="{{ product.selected_or_first_available_variant.id }}"
  {% if hide_on_zero %}
    hide-when-zero
  {% endif %}
  style="--ezz-margin: {{ margin_value }}; --ezz-padding: {{ padding_value }}; --ezz-font-size: {{ font_size }}px; --ezz-text-color: {{ text_color }}; --ezz-bg-color: {{ background_color }}; --ezz-border-radius: {{ border_radius }}px"
>
  <span data-ezz-cart-count-singular>
    {{ '[[COUNT]] item in your cart' | replace: '[[COUNT]]', '<span data-ezz-cart-count></span>' }}
  </span>
  <span data-ezz-cart-count-plural>
    {{ '[[COUNT]] items in your cart' | replace: '[[COUNT]]', '<span data-ezz-cart-count></span>' }}
  </span>
</ezz-cart-count>

Explanation of the Code: