Fix: Upsells collection not showing correct products on frontend (#51730)
* Fix: Upsells collection not showing correct products on frontend This commit addresses an issue where the Upsells collection wasn't displaying the correct products on the frontend. The problem was caused by a variable name mismatch in the condition checking for empty product references. * Add changefile(s) from automation for the following project(s): woocommerce * Rename product_references variable for consistency * Update variable name --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com>
This commit is contained in:
parent
e6d0a906fb
commit
0d9d06cd46
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: fix
|
||||||
|
|
||||||
|
Product Collection: Fix Upsells collection not showing linked product on Frontend on Single Product Template
|
|
@ -2053,7 +2053,7 @@ class ProductCollection extends AbstractBlock {
|
||||||
function ( $collection_args, $query ) {
|
function ( $collection_args, $query ) {
|
||||||
$product_references = isset( $query['productReference'] ) ? array( $query['productReference'] ) : null;
|
$product_references = isset( $query['productReference'] ) ? array( $query['productReference'] ) : null;
|
||||||
// Infer the product reference from the location if an explicit product is not set.
|
// Infer the product reference from the location if an explicit product is not set.
|
||||||
if ( empty( $product_reference ) ) {
|
if ( empty( $product_references ) ) {
|
||||||
$location = $collection_args['productCollectionLocation'];
|
$location = $collection_args['productCollectionLocation'];
|
||||||
if ( isset( $location['type'] ) && 'product' === $location['type'] ) {
|
if ( isset( $location['type'] ) && 'product' === $location['type'] ) {
|
||||||
$product_references = array( $location['sourceData']['productId'] );
|
$product_references = array( $location['sourceData']['productId'] );
|
||||||
|
|
Loading…
Reference in New Issue