W3 Total Cache is a very advanced plugin that has built in ways to handle almost any situation.
To exclude a page from being cached use one of the following commands below:
define('DONOTCACHEPAGE', true);
Disables page caching for a given page.
define('DONOTCACHEDB', true);
Disables database caching for given page.
define('DONOTMINIFY', true);
Disables minify for a given page.
define('DONOTCDN', true);
Disables content delivery network for a given page.
define('DONOTCACHCEOBJECT', true);
Disables object cache for a given page.
To make W3 Total empty the cache on your product edit you can hook the following function in when the product is saved:
w3tc_pgcache_flush_post($post_id);
To implement fragment caching wrap the functions or lines of code that you don’t want to cache in an mfunc:
Example 1:
<!-- mfunc any PHP code --><!-- /mfunc -->
Example 2:
<!-- mfunc -->any PHP code<!-- /mfunc -->
Example 3:
<!--MFUNC -->
echo rand();
<!--/mfunc -->
Example 4:
<!-- mclude path/to/file.php --><!-- /mclude -->
Example 5:
<!-- mclude -->path/to/file.php<!-- /mclude -->