WC_Cart_Session::set_updates_enabled_for_cart │ public static │ WC 11.2.0

Enables or disables session updates for a cart.

Метод класса: WC_Cart_Session{}

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = WC_Cart_Session::set_updates_enabled_for_cart( $cart, $enabled ): void;
$cart(WC_Cart) (обязательный)
Cart object.
$enabled(true|false) (обязательный)
Whether session updates should be enabled.

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

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

Код WC_Cart_Session::set_updates_enabled_for_cart() WC 11.3.0

public static function set_updates_enabled_for_cart( WC_Cart $cart, $enabled ): void {
	$cart_id = spl_object_id( $cart );

	if ( $enabled ) {
		unset( self::$carts_with_disabled_updates[ $cart_id ] );
	} else {
		self::$carts_with_disabled_updates[ $cart_id ] = WeakReference::create( $cart );
	}
}