WC_Cart_Session::maybe_set_cart_cookies()

Will set cart cookies if needed and when possible.


Description Description


Source Source

File: includes/class-wc-cart-session.php

	public function maybe_set_cart_cookies() {
		if ( ! headers_sent() && did_action( 'wp_loaded' ) ) {
			if ( ! $this->cart->is_empty() ) {
				$this->set_cart_cookies( true );
			} elseif ( isset( $_COOKIE['woocommerce_items_in_cart'] ) ) { // WPCS: input var ok.
				$this->set_cart_cookies( false );
			}
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.