Don't display Upsells collection if there's no upsells

This commit is contained in:
Karol Manijak 2024-09-17 11:36:12 +08:00
parent 9168c15031
commit 793847b250
1 changed files with 3 additions and 1 deletions

View File

@ -1887,8 +1887,10 @@ class ProductCollection extends AbstractBlock {
);
}
$upsells = $product->get_upsell_ids();
return array(
'post__in' => $product->get_upsell_ids(),
'post__in' => empty( $upsells ) ? array( -1 ) : $upsells,
);
},
function ( $collection_args, $query ) {