Title: Exclude template part from cache
Last modified: September 11, 2019

---

# Exclude template part from cache

 *  Resolved [christian70](https://wordpress.org/support/users/christian70/)
 * (@christian70)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/exclude-template-part-from-cache/)
 * 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)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/exclude-template-part-from-cache/#post-11926269)
 * 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](https://wordpress.org/support/users/christian70/)
 * (@christian70)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/exclude-template-part-from-cache/#post-11926319)
 * 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.

 * ![](https://ps.w.org/cache-enabler/assets/icon.svg?rev=2442383)
 * [Cache Enabler](https://wordpress.org/plugins/cache-enabler/)
 * [Support Threads](https://wordpress.org/support/plugin/cache-enabler/)
 * [Active Topics](https://wordpress.org/support/plugin/cache-enabler/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cache-enabler/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cache-enabler/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [christian70](https://wordpress.org/support/users/christian70/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/exclude-template-part-from-cache/#post-11926319)
 * Status: resolved