I NEED TO SHOW TWO CURRENCY in my _box.html.twig


#1

I NEED TO SHOW TWO CURRENCY (dollar and euro ) in my _box.html.twig

how can i do that


#2

Override @SyliusShop/Common/Macro/money.html.twig templates’ convertAndFormat and calcuatePrice macroses with this:

{%- macro convertAndFormat(amount, currency) -%}
    {% set currency = currency|default(sylius.currencyCode) %}
    {% from _self import format %}

    {{- format(amount|sylius_convert_money(sylius.channel.baseCurrency.code, currency), currency) }}
{%- endmacro -%}

{%- macro calculatePrice(variant, currency) -%}
    {% from _self import convertAndFormat %}

    {{- convertAndFormat(variant|sylius_calculate_price({'channel': sylius.channel}), currency) }}
{%- endmacro -%}

After this you can use {{ money.calculatePrice(product|sylius_resolve_variant, 'USD') }} somewhere in _box.html.twig , where ‘USD’ is your preffered currency


#3

its working :slight_smile: tks u