Skip to main content

Add a remaining items message to a cart layout email

Limit the number of items shown in your cart layout email and display a message when the shopper has more items in their cart than are shown.

Updated over a week ago

You can add a remaining items message to your cart layout email to keep your email design concise while still informing shoppers when more items are in their cart than the layout displays. Learn how to use Jinja variables and a limit filter to calculate the total number of carted items and display a message when additional items are not shown in the layout.


Add a remaining items message

Make the following 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?