WC_Session_Handler::maybe_set_customer_session_cookie
Hooks into the wp action to maybe set the session cookie if the user is on a certain page e.g. a checkout endpoint.
Certain gateways may rely on sessions and this ensures a session is present even if the customer does not have a cart.
Method of the class: WC_Session_Handler{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Session_Handler = new WC_Session_Handler(); $WC_Session_Handler->maybe_set_customer_session_cookie();
WC_Session_Handler::maybe_set_customer_session_cookie() WC Session Handler::maybe set customer session cookie code WC 10.3.3
public function maybe_set_customer_session_cookie() {
if ( is_wc_endpoint_url( 'order-pay' ) ) {
$this->set_customer_session_cookie( true );
}
}