Remove call to header_register_callback and revert to 3.5 cookie handling

This commit is contained in:
Mike Jolley 2019-04-17 23:50:42 +01:00
parent 14241b3f19
commit b697be51d4
1 changed files with 3 additions and 7 deletions

View File

@ -53,13 +53,9 @@ final class WC_Cart_Session {
add_action( 'woocommerce_cart_updated', array( $this, 'persistent_cart_update' ) );
// Cookie events - cart cookies need to be set before headers are sent.
if ( function_exists( 'header_register_callback' ) ) {
header_register_callback( array( $this, 'maybe_set_cart_cookies' ) ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.header_register_callbackFound
} else {
add_action( 'woocommerce_add_to_cart', array( $this, 'maybe_set_cart_cookies' ) );
add_action( 'wp', array( $this, 'maybe_set_cart_cookies' ), 99 );
add_action( 'shutdown', array( $this, 'maybe_set_cart_cookies' ), 0 );
}
add_action( 'woocommerce_add_to_cart', array( $this, 'maybe_set_cart_cookies' ) );
add_action( 'wp', array( $this, 'maybe_set_cart_cookies' ), 99 );
add_action( 'shutdown', array( $this, 'maybe_set_cart_cookies' ), 0 );
}
/**