{% comment %}
  Renders a message about free shipping in the cart.

  Usage:
  {% render 'cart-free-shipping' %}
{% endcomment %}

{% liquid
  assign total_amount = cart.total_price | divided_by: 100.0
%}

{% if settings.show_cart_free_shipping %}
  <xo-cart-free-shipping-custom
    xo-free-shipping-notice='{{ 'general.cart.free_shipping_notice' | t }}'
    xo-free-shipping-progress='{{ 'general.cart.free_shipping_progress' | t }}'
  >
    <div class='xo-cart-free-shipping'>
      <xo-cart-will-change
        xo-unique-id='xo-cart-free-shipping-checking-inner'
        class='xo-cart-free-shipping-checking-inner xo-visually-hidden'
        xo-total-price='{{ cart.total_price }}'
      >
        {{- cart.total_price -}}
      </xo-cart-will-change>
      <xo-cart-will-change xo-unique-id='xo-cart-free-shipping-checking' class='xo-cart-free-shipping__checking'>
        {%- if cart != empty -%}{{- total_amount -}}{%- endif -%}
      </xo-cart-will-change>
      <div class='xo-cart-free-shipping__position'>
        <xo-cart-will-change xo-unique-id='xo-cart-free-shipping-text' class='xo-cart-free-shipping__text'>
          {{ 'general.cart.free_shipping_notice' | t }}
        </xo-cart-will-change>
        <div
          class='xo-cart-free-shipping__progress'
        >
          {{ total_amount }}
        </div>
      </div>
    </div>
  </xo-cart-free-shipping-custom>
{% endif %}
