WC_Cart_Session::are_updates_enabled_for_cart
Checks whether session updates are enabled for a cart.
Method of the class: WC_Cart_Session{}
No Hooks.
Returns
bool.
Usage
$result = WC_Cart_Session::are_updates_enabled_for_cart( $cart ): bool;
- $cart(WC_Cart) (required)
- Cart object.
Changelog
| Since 11.2.0 | Introduced. |
WC_Cart_Session::are_updates_enabled_for_cart() WC Cart Session::are updates enabled for cart code WC 11.3.0
public static function are_updates_enabled_for_cart( WC_Cart $cart ): bool {
$cart_id = spl_object_id( $cart );
if ( ! isset( self::$carts_with_disabled_updates[ $cart_id ] ) ) {
return true;
}
$disabled_cart = self::$carts_with_disabled_updates[ $cart_id ]->get();
if ( null === $disabled_cart ) {
unset( self::$carts_with_disabled_updates[ $cart_id ] );
return true;
}
return $disabled_cart !== $cart;
}