Skip to main content
All CollectionsContentCart layout
Add a remaining items message to a cart layout email
Add a remaining items message to a cart layout email

Tell your customers how many items are in their carts.

Updated over 11 months ago

You may want to limit the number of items shown in an email to avoid making it too long when a large number of items are browsed or carted. However, you may also want to show a message to inform your customer that they have more items remaining than have been displayed.


Add a remaining items message

You can do this by making the below changes to your cart layout:

  1. Go to Content > Cart Layout.

  2. Create a new cart layout or edit an existing one.

  3. Insert the following code at the top of the Edit the Cart Layout field:

    {% set max_products_to_show = 3 %} {# Set maximum number of products to show in cart #} 
    {% set product_count = products|length %} {# Get total number of products in cart #}
    {% set remaining_products = product_count - max_products_to_show %} {# Get number of remaining products #}
  4. Insert a limit filter to the product For loop:

    {% for products in products|limit(max_products_to_show) %}
  5. Insert this code where you'd like to show the remaining items message:

    {% if remaining_products > 0 %}
    and {{ remaining_products }} more item(s) in your cart.
    {% endif %}
Did this answer your question?