woocommerce_cart_session_initialize
Filters whether hooks should be initialized for the current cart session.
Usage
add_filter( 'woocommerce_cart_session_initialize', 'wp_kama_woocommerce_cart_session_initialize_filter', 10, 2 );
/**
* Function for `woocommerce_cart_session_initialize` filter-hook.
*
* @param bool $must_initialize Will be passed as true, meaning that the cart hooks should be initialized.
* @param bool $session The WC_Cart_Session object that is being initialized.
*
* @return bool
*/
function wp_kama_woocommerce_cart_session_initialize_filter( $must_initialize, $session ){
// filter...
return $must_initialize;
}
- $must_initialize(true|false)
- Will be passed as true, meaning that the cart hooks should be initialized.
- $session(true|false)
- The WC_Cart_Session object that is being initialized.
Changelog
| Since 6.9.0 | Introduced. |
Where the hook is called
woocommerce_cart_session_initialize
woocommerce/includes/class-wc-cart-session.php 70
if ( ! apply_filters( 'woocommerce_cart_session_initialize', true, $this ) ) {