Exclude up-sells from related products. Closes #1555.

This commit is contained in:
Mike Jolley 2012-10-12 18:44:23 +01:00
parent c9a6680438
commit 2b0c8bdbda
2 changed files with 4 additions and 3 deletions

View File

@ -1226,7 +1226,7 @@ class WC_Product {
$meta_query[] = $woocommerce->query->stock_status_meta_query();
// Get the posts
$related_posts = get_posts(apply_filters('woocommerce_product_related_posts', array(
$related_posts = get_posts( apply_filters('woocommerce_product_related_posts', array(
'orderby' => 'rand',
'posts_per_page'=> $limit,
'post_type' => 'product',
@ -1245,9 +1245,9 @@ class WC_Product {
'terms' => $tags_array
)
)
)));
) ) );
$related_posts = array_diff( $related_posts, array($this->id) );
$related_posts = array_diff( $related_posts, array( $this->id ), $this->get_upsells() );
return $related_posts;
}

View File

@ -197,6 +197,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Tweak - Admin sales stats show totals.
* Tweak - product_variations_{id} changed to product_variations array
* Tweak - Coupon description field.
* Tweak - Exclude up-sells from related products.
* Fix - Added more error messages for coupons.
* Fix - Variation sku updating after selection.