Only run maybe_set_cart_cookies if cart was loaded

This commit is contained in:
Mike Jolley 2015-09-07 11:38:22 +01:00
parent 4bda0f2387
commit 1c68137cf9
1 changed files with 1 additions and 1 deletions

View File

@ -169,7 +169,7 @@ class WC_Cart {
* Will set cart cookies if needed, once, during WP hook
*/
public function maybe_set_cart_cookies() {
if ( ! headers_sent() ) {
if ( ! headers_sent() && did_action( 'wp_loaded' ) ) {
if ( ! $this->is_empty() ) {
$this->set_cart_cookies( true );
} elseif ( isset( $_COOKIE['woocommerce_items_in_cart'] ) ) {