diff --git a/browser/templates/_types/cart/_mini.html b/browser/templates/_types/cart/_mini.html index b5ae6d4..390755c 100644 --- a/browser/templates/_types/cart/_mini.html +++ b/browser/templates/_types/cart/_mini.html @@ -1,9 +1,12 @@ -{% macro mini(oob=False) %} +{% macro mini(oob=False, count=None) %}
{# cart_count is set by the context processor in all apps. Cart app computes it from g.cart + calendar_cart_entries; - other apps get it from the cart internal API. #} - {% if cart_count is defined and cart_count is not none %} + other apps get it from the cart internal API. + count param allows explicit override when macro is imported without context. #} + {% if count is not none %} + {% set _count = count %} + {% elif cart_count is defined and cart_count is not none %} {% set _count = cart_count %} {% elif cart is defined and cart is not none %} {% set _count = (cart | sum(attribute="quantity")) + ((calendar_cart_entries | length) if calendar_cart_entries else 0) %}