• Post per page is set at 12, but only 2 related products show. I added the following script to increase that to 4 – which works but it overrides the category/tag filter so products from all cats/tags are included. How can I modify this to show 4 products AND still filter by tag ?

    function woo_related_products_limit() {
    global $product;
    $args = array(
    'post_type' => 'product',
    'no_found_rows' => 1,
    'posts_per_page' => 4,
    'ignore_sticky_posts' => 1,
    'orderby' => $orderby,
    'post__in' => $related,
    'post__not_in' => array($product->id)
    
    );
    return $args;
    }
    
    add_filter( 'woocommerce_related_products_args', 'woo_related_products_limit' );

    https://www.ads-software.com/plugins/woocommerce/

  • The topic ‘Increase number of related products’ is closed to new replies.