Set session when removing last item. Closes #3739
This commit is contained in:
parent
97b1e176d2
commit
5954619e02
|
@ -942,9 +942,9 @@ class WC_Cart {
|
|||
|
||||
if ( $quantity == 0 || $quantity < 0 ) {
|
||||
do_action( 'woocommerce_before_cart_item_quantity_zero', $cart_item_key );
|
||||
unset( $this->cart_contents[$cart_item_key] );
|
||||
unset( $this->cart_contents[ $cart_item_key ] );
|
||||
} else {
|
||||
$this->cart_contents[$cart_item_key]['quantity'] = $quantity;
|
||||
$this->cart_contents[ $cart_item_key ]['quantity'] = $quantity;
|
||||
do_action( 'woocommerce_after_cart_item_quantity_update', $cart_item_key, $quantity );
|
||||
}
|
||||
|
||||
|
@ -1329,8 +1329,10 @@ class WC_Cart {
|
|||
|
||||
do_action( 'woocommerce_before_calculate_totals', $this );
|
||||
|
||||
if ( sizeof( $this->get_cart() ) == 0 )
|
||||
if ( sizeof( $this->get_cart() ) == 0 ) {
|
||||
$this->set_session();
|
||||
return;
|
||||
}
|
||||
|
||||
// Get count of all items + weights + subtotal (we may need this for discounts)
|
||||
$subtotal = 0;
|
||||
|
|
|
@ -296,7 +296,7 @@ class WC_Form_Handler {
|
|||
|
||||
wc_add_message( __( 'Cart updated.', 'woocommerce' ) );
|
||||
|
||||
$referer = ( wp_get_referer() ) ? wp_get_referer() : WC()->cart->get_cart_url();
|
||||
$referer = wp_get_referer() ? wp_get_referer() : WC()->cart->get_cart_url();
|
||||
wp_safe_redirect( $referer );
|
||||
exit;
|
||||
|
||||
|
|
Loading…
Reference in New Issue