• Resolved christian70

    (@christian70)


    I’m using Woocommerce along with WPML. Everything is ok when cache is enabled, apart form a mini cart used with the cart icon in the main menu, including items in the cart and link to the cart page: switching from one language to the other, the language of mini cart content gets wrong. The code is added with a function that includes the mini-cart template from the child theme (something like get_template_part( ‘tpls/wc-mini-cart’ )).

    I wonder if there’s a way to exclude that template part from being cached even in the cached pages (the Woocommerce pages are not cached by default so the mini cart works properly in them). Any suggestion on how to fix that will be appreciated.

    Thanks a lot.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Anonymous User 16850768

    (@anonymized-16850768)

    The Cache Enabler plugin doesn’t support excluding a part of a page from being cached. This is not supported because it would defeat the purpose of the plugin as each page would have to be generated on each request instead of delivering a page that has already been generated and cached. A JavaScript solution would be required to have dynamic content on a cached page.

    Thread Starter christian70

    (@christian70)

    Thank you for your notice. I understand, but I got a little trick. Given that the template part is added by a function – call it my_function() – I excluded this function from being cached like this (I found it in a previous support ticket):
    add_filter( 'bypass_cache', 'my_function' );
    and it seems to work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude template part from cache’ is closed to new replies.