daily pastebin goal
78%
SHARE
TWEET

WooCommerce - Related products pool size

lorro Oct 7th, 2015 117 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
Top