Merge pull request #16570 from woocommerce/fix/16568

Add product to cart on each iteration for BW compat.
This commit is contained in:
Claudiu Lodromanean 2017-08-22 09:31:21 -07:00 committed by GitHub
commit 6c2a944b74
1 changed files with 4 additions and 3 deletions

View File

@ -87,13 +87,14 @@ final class WC_Cart_Session {
} else {
// Put session data into array. Run through filter so other plugins can load their own session data.
$session_data = array_merge( $values, array( 'data' => $product ) );
$session_data = array_merge( $values, array( 'data' => $product ) );
$cart_contents[ $key ] = apply_filters( 'woocommerce_get_cart_item_from_session', $session_data, $values, $key );
// Add to cart right away so the product is visible in woocommerce_get_cart_item_from_session hook.
$this->cart->set_cart_contents( $cart_contents );
}
}
}
$this->cart->set_cart_contents( $cart_contents );
}
do_action( 'woocommerce_cart_loaded_from_session', $this->cart );