daily pastebin goal
51%
SHARE
TWEET

WooCommerce - Related products pool size

lorro Oct 7th, 2015 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.   // fetch related products from a bigger pool
  3.   // code goes in functions.php for your child theme
  4.   add_filter('woocommerce_related_products_args', 'my_related');
  5.   function my_related($args) {
  6.     global $product;
  7.     $pool_size = 10;
  8.     $related = $product->get_related($pool_size);
  9.     if ( sizeof( $related ) == 0 ) return $args;
  10.     $args["post__in"] = $related;
  11.     return $args;
  12.   } // end function
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top