Skip to content

Commit

Permalink
Fixed undefined cart_cached if price change feature not used.
Browse files Browse the repository at this point in the history
  • Loading branch information
seb86 committed Oct 16, 2023
1 parent e1df402 commit f8f44a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion includes/classes/class-cocart-session.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] );
Expand All @@ -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();
Expand Down

0 comments on commit f8f44a4

Please sign in to comment.