Add product to cart on each iteration for BW compat.

Closes #16568
This commit is contained in:
Mike Jolley 2017-08-22 16:39:51 +01:00
parent 0bad6b3e52
commit a70e9bbf9b
1 changed files with 4 additions and 1 deletions

View File

@ -89,6 +89,9 @@ final class WC_Cart_Session {
// 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 ) );
$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 );
}
}
}