• Resolved bearshang

    (@bearshang)


    Just like this example: Change number of related products output, He does not work.

    So I changed a way, He can work normally, but there is a problem:

    
    add_filter( 'woocommerce_output_related_products_args', function ( $args ) {
        $args = [
    	'posts_per_page' => 8,
    	'columns'        => 3,
    	'orderby'        => 'rand', // @codingStandardsIgnoreLine.
        ];
    
        return $args;
    }, 20 );
    

    If set ‘posts_per_page’ value is -1, I didn’t get all the related product.
    If i want get all the related product, How to do?

Viewing 1 replies (of 1 total)
  • Hi @bearshang

    Sorry for the delay in getting back to you.

    If set ‘posts_per_page’ value is -1, I didn’t get all the related product.
    If i want get all the related product, How to do?

    Not sure if there is a way to do this directly. Setting posts_per_page to -1 may not work off-the-shelf.

    One workaround would be to set a significantly high number like 30 or so for the posts_per_page value; this might work.

Viewing 1 replies (of 1 total)

The topic ‘How to change number of related products output unlimit number ?’ is closed to new replies.