cancel
Showing results for 
Search instead for 
Did you mean: 

Currency switcher doesn't affect home page

SOLVED

Currency switcher doesn't affect home page

PROBLEM: Currency switch doesn't affect home page

My website has 2 currencies: USD/CAD

I have configured currency rates. Add Fixer.IO key.

 

When I try to change currency on home page it doesn't changes. But when I go to other route all work well.

 

Tried to clear cache, but it doesn't get workimage.pngimage.png

Home page(product and current currency):

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Currency switcher doesn't affect home page

Solved by setting cache_lifetime to null for block

View solution in original post

5 REPLIES 5

Re: Currency switcher doesn't affect home page

Hello @ussorawayf4404 

 

You need to set cache life time of block and widgets. Kindly refer below code reference:

<type name="MyBlock">
    <arguments>
        <argument name="data" xsi:type="array">
            <item name="cache_lifetime" xsi:type="number">3600</item>
        </argument>
    </arguments>
</type>

It may help you!
Thank you

Problem solved? Click Accept as Solution!

Re: Currency switcher doesn't affect home page

my block is:

{{block class="Magento\\Cms\\Block\\Block" block_id="id1-block2" cacheable="false"}}

Re: Currency switcher doesn't affect home page

Hello @ussorawayf4404 

 

"Cachable" = false also work but in this case, complete page cache will collapse and page load speed will increase.
You can also refer below steps:

1. On the admin sidebar
2. Go to Stores > Configuration > Advanced > System > Full Page Cache.
3. In the caching Application field, select one of the following
Built-in Application
Varnish Caching
4. In the TTL (time to live) for the public content field set the time-out for the page cache. The default value is 86400.

It may help you.
Thank you

Problem solved? Click Accept as Solution!

Re: Currency switcher doesn't affect home page

My homepage has next content (Content -> Pages -> Home)

image.png

Cache in system:

image.png

Re: Currency switcher doesn't affect home page

Solved by setting cache_lifetime to null for block