From f8f44a45678a3c86280cd25a9897a72bbf1427ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dumont?= Date: Mon, 16 Oct 2023 21:14:08 +0200 Subject: [PATCH] Fixed undefined `cart_cached` if price change feature not used. --- includes/classes/class-cocart-session.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/classes/class-cocart-session.php b/includes/classes/class-cocart-session.php index 7539cd7..cc93b04 100644 --- a/includes/classes/class-cocart-session.php +++ b/includes/classes/class-cocart-session.php @@ -252,7 +252,6 @@ public static function load_cart_action() { WC()->session->set( 'coupon_discount_totals', $new_cart['coupon_discount_totals'] ); WC()->session->set( 'coupon_discount_tax_totals', $new_cart['coupon_discount_tax_totals'] ); WC()->session->set( 'removed_cart_contents', $new_cart['removed_cart_contents'] ); - WC()->session->set( 'cart_cached', $new_cart['cart_cached'] ); if ( ! empty( $new_cart['chosen_shipping_methods'] ) ) { WC()->session->set( 'chosen_shipping_methods', $new_cart['chosen_shipping_methods'] ); @@ -262,6 +261,10 @@ public static function load_cart_action() { WC()->session->set( 'cart_fees', $new_cart['cart_fees'] ); } + if ( ! empty( $new_cart['cart_cached'] ) ) { + WC()->session->set( 'cart_cached', $new_cart['cart_cached'] ); + } + // Set loaded cart for guest customer. if ( ! is_user_logged_in() && self::maybe_use_cookie_monster() ) { WC()->session->set_cart_hash();