ESI Shortcode Still Caching even with private/low ttl
-
Hey guys – I have the following function in my functions.php:
function cart_count_shortcode() {
if (class_exists('WooCommerce')) {
$cart_count = WC()->cart->get_cart_contents_count();
if ($cart_count) {
return '' . $cart_count . '';
}
}
return '';
}
add_shortcode('cart_count', 'cart_count_shortcode');and then in a template I have:
<?php echo do_shortcode('[esi cart_count ttl="1" cache="private"]'); ?>
But I can go onto an incognito window, add something to my woocommerce cart, but the source HTML comes out as:
<a class="square-button green-bg" href="/cart">
<i class="fas fa-shopping-cart"></i>
<!-- lscwp esi-shortcode -->
<!-- Block cached by LiteSpeed Cache 6.4 on 2024-08-14 23:01:44 -->
<!-- lscwp esi-shortcode esi end -->
</a>So the ttl/private doesn’t really seem to work for me, as that timestamp is yesterday.
Do you know if I’m missing something?
Thanks!
The page I need help with: [log in to see the link]
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘ESI Shortcode Still Caching even with private/low ttl’ is closed to new replies.