{% comment %}
  Renders a cart's subtotal and total price.

  Usage:
  {% render 'cart-totals' %}
{% endcomment %}

{% liquid
  assign total_price = cart.total_price | money
  if settings.currency_code_enabled
    assign total_price = cart.total_price | money_with_currency
  endif
%}

<xo-cart-will-change xo-unique-id='xo-cart-totals-{{ section.id }}' class='xo-cart-totals'>
  {% if cart != empty %}
    <div class='xo-cart-totals__subtotal'>{{ 'sections.cart.subtotal' | t }}</div>
    <div class='xo-cart-totals__value'>{{ total_price }}</div>
  {% endif %}
</xo-cart-will-change>
