Solves Cross-Sells display variable product (#37616)

Solved cross-sells display issue on cart
This commit is contained in:
Shojib khan 2023-05-02 20:24:22 +06:00 committed by GitHub
parent 4145b6e0f7
commit 0ae9ec0844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fixed Cross-Sells display variable product

View File

@ -822,6 +822,11 @@ class WC_Cart extends WC_Legacy_Cart {
if ( $values['quantity'] > 0 ) {
$cross_sells = array_merge( $values['data']->get_cross_sell_ids(), $cross_sells );
$in_cart[] = $values['product_id'];
// Add variations to the in cart array.
if ( $values['data']->is_type( 'variation' ) ) {
$in_cart[] = $values['variation_id'];
}
}
}
}