When getting a cart from a session and there are contents as well as contents in the persistant cart, merge the two carts to avoid loosing the persistant cart content.
This commit is contained in:
parent
3ed021241f
commit
ccb54faf0b
|
@ -76,6 +76,9 @@ final class WC_Cart_Session {
|
|||
$update_cart_session = true;
|
||||
} elseif ( is_null( $cart ) ) {
|
||||
$cart = array();
|
||||
} elseif ( is_array( $cart ) && ( $saved_cart = get_user_meta( get_current_user_id(), '_woocommerce_persistent_cart_' . get_current_blog_id(), true ) ) ) {
|
||||
$cart = array_merge( $saved_cart['cart'], $cart );
|
||||
$update_cart_session = true;
|
||||
}
|
||||
|
||||
if ( is_array( $cart ) ) {
|
||||
|
|
Loading…
Reference in New Issue