Hi!
I thought this would be easy with Twig, but I just cannot get it working. I need to subtract the Cart total from 40,00 €, which is the minimum order amount for free shipping.
I have the current cart amount: {{ woocommerce.cart_total_raw }}
. (I tried the other cart total versions as well). This outputs 8,78 €
, with a comma and € with a space.
I have the Minimum order amount set dynamically: {{woocommerce.free_shipping_min}}
, but this can be hard-coded to 40,00 €
if that makes it simpler.
I have a hard-coded Twig calculation that works:
{% set currency = ' €' %}
{% set min_clean = '40.00' %}
{% set cart_clean = '8.78' %}
{% set remaining = max(min_clean - cart_clean, 0) %}
{{ remaining | number_format(2, ',', '.') ~ currency }}
But, I simply cannot get the dynamic one to work, that would show the remaining amount left until free shipping. (I tried with the “Advanced” extension on as well).
Can you please help me with this?
Thank you!