I'm trying to make WP Super Cache work with a shopping cart (so that if the $_COOKIE['cartItems'] variable is greater than zero the visitor is served dynamic pages).
I've tried making my own plugin as I've read here and here, but I'm not having much luck. Here's my plugin code:
function wp_supercache_dontcachecart( $string ) {
if( $_COOKIE[ 'cartItems' ] > 0 ) {
$string = 'cartItems';
}
return $string;
}
add_cacheaction( 'wp_cache_get_cookies_values', 'wp_supercache_dontcachecart' );
Any idea what I'm doing wrong? Thanks!