0 ) { $wc_page_uris[] = 'p=' . $cart_page_id; $page = get_post( $cart_page_id ); if ( ! is_null( $page ) ) { $wc_page_uris[] = '/' . $page->post_name; } } if ( ( $checkout_page_id = wc_get_page_id( 'checkout' ) ) && $checkout_page_id > 0 ) { $wc_page_uris[] = 'p=' . $checkout_page_id; $page = get_post( $checkout_page_id ); if ( ! is_null( $page ) ) { $wc_page_uris[] = '/' . $page->post_name; } } if ( ( $myaccount_page_id = wc_get_page_id( 'myaccount' ) ) && $myaccount_page_id > 0 ) { $wc_page_uris[] = 'p=' . $myaccount_page_id; $page = get_post( $myaccount_page_id ); if ( ! is_null( $page ) ) { $wc_page_uris[] = '/' . $page->post_name; } } set_transient( 'woocommerce_cache_excluded_uris', $wc_page_uris ); } if ( is_array( $wc_page_uris ) ) { foreach( $wc_page_uris as $uri ) { if ( strstr( $_SERVER['REQUEST_URI'], $uri ) ) { self::nocache(); break; } } } } /** * Set nocache constants and headers. * * @access private * @return void */ private static function nocache() { if ( ! defined( 'DONOTCACHEPAGE' ) ) define( "DONOTCACHEPAGE", "true" ); if ( ! defined( 'DONOTCACHEOBJECT' ) ) define( "DONOTCACHEOBJECT", "true" ); if ( ! defined( 'DONOTCACHEDB' ) ) define( "DONOTCACHEDB", "true" ); nocache_headers(); } /** * notices function. * * @access public * @return void */ public static function notices() { if ( ! function_exists( 'w3tc_pgcache_flush' ) || ! function_exists( 'w3_instance' ) ) { return; } $config = w3_instance('W3_Config'); $enabled = $config->get_integer( 'dbcache.enabled' ); $settings = $config->get_array( 'dbcache.reject.sql' ); if ( $enabled && ! in_array( '_wc_session_', $settings ) ) { ?>
database caching to work with WooCommerce you must add _wc_session_
to the "Ignored Query Strings" option in W3 Total Cache settings here.', 'woocommerce' ), admin_url( 'admin.php?page=w3tc_dbcache' ) ); ?>