woocommerce_cart_session_initialize хук-фильтрWC 6.9.0

Filters whether hooks should be initialized for the current cart session.

Использование

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.

Список изменений

С версии 6.9.0 Введена.

Где вызывается хук

WC_Cart_Session::init()
woocommerce_cart_session_initialize
woocommerce/includes/class-wc-cart-session.php 57
if ( ! apply_filters( 'woocommerce_cart_session_initialize', true, $this ) ) {

Где используется хук в WooCommerce

Использование не найдено.