• Resolved gluecklichezwerge

    (@gluecklichezwerge)


    Hello,

    I am sorry if this has already been discussed, but the search function is really horrible. ??
    Maybe I am in the wrong section, because I don’t know if this is theme related. Sorry for this as well.
    I would like to re-design my related products output and already tried several ways, but am not able to change the amount of displayed products. I thought this might be due to image sizes and re-sized them through functions.php. This is working fine, but I still have only 3 items being displayed.
    The code I tried:

    function woo_related_products_limit() {
      global $product;
    	$args['posts_per_page'] = 6;
    	return $args;
    }
    add_filter( 'woocommerce_output_related_products_args', 'jk_related_products_args' );
      function jk_related_products_args( $args ) {
    	$args['posts_per_page'] = 4; // 4 related products
    	$args['columns'] = 1; // arranged in 1 column
    	return $args;
    }

    The main reason for these changes: I wanted to add a related products slider, but even plugins didn’t display more than 3 items.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter gluecklichezwerge

    (@gluecklichezwerge)

    Solution for everybody having the same issue:
    Issue is really theme related. To display more than 3 items in Storefront theme add this to your themes functions.php:

    add_filter( 'woocommerce_output_related_products_args', 'change_related_products_amount', 9999 );
     
    function change_related_products_amount( $args ) {
     $args['posts_per_page'] = 4; // # of related products
     $args['columns'] = 4; // # of columns per row
     return $args;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Related Products’ is closed to new replies.