{% macro add(slug, cart, oob='false') %} {% set quantity = cart | selectattr('product.slug', 'equalto', slug) | sum(attribute='quantity') %}
{% if not quantity %}
{% else %}
{{ quantity }}
{% endif %}
{% endmacro %} {% macro cart_item(oob=False) %} {% set p = item.product %} {% set unit_price = p.special_price or p.regular_price %}
{% if p.image %} {{ p.title }} {% else %}
No image
'market', 'product', p.slug {% endif %}
{# Details #}

{% set href=url_for('market.browse.product.product_detail', slug=p.slug) %} {{ p.title }}

{% if p.brand %}

{{ p.brand }}

{% endif %} {% if item.is_deleted %}

This item is no longer available or price has changed

{% endif %}
{# Unit price #}
{% if unit_price %} {% set symbol = "£" if p.regular_price_currency == "GBP" else p.regular_price_currency %}

{{ symbol }}{{ "%.2f"|format(unit_price) }}

{% if p.special_price and p.special_price != p.regular_price %}

{{ symbol }}{{ "%.2f"|format(p.regular_price) }}

{% endif %} {% else %}

No price

{% endif %}
Quantity
{{ item.quantity }}
{% if unit_price %} {% set line_total = unit_price * item.quantity %} {% set symbol = "£" if p.regular_price_currency == "GBP" else p.regular_price_currency %}

Line total: {{ symbol }}{{ "%.2f"|format(line_total) }}

{% endif %}
{% endmacro %}