Changing number of products displayed on page (4 posts)

  1. brown7905
    Posted 3 years ago #

    I am working with someone to create a store on their site using WooCommerce.

    I have tried literally everything to change the number of products that appear on the front page and no matter what I do it will not change.

    The code I've been trying on functions.php (among many others) is

    // Display 24 products per page. Goes in functions.php
    add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 );

    It hasn't worked. I've also tried to change the number of posts under Settings>Reading. No luck there.

    I was able to change to the number of columns by using this code

    // Change number or products per row to 3
    add_filter('loop_shop_columns', 'loop_columns');
    if (!function_exists('loop_columns')) {
    	function loop_columns() {
    		return 3; // 3 products per row

    For some reason this worked in functions.php, so I have no idea why the number of products changing isn't working here.

    The site is http://www.melissatucker.com/shop

    If anyone has any ideas I'd really appreciate it!


  2. mattprice1707
    Posted 3 years ago #

    I see from looking at your code that you're using an elegant themes theme. These options can be changed in epanel>generalsettings>homepage. Where it says 'number of recent posts displayed on homepage' set it to whatever number that you want.

  3. moodytryme
    Posted 3 years ago #

    Hi !

    I'm having a conflict with the WordPress blog pagination and the WP e commerce pagination, and I was told to desactivate the Pagination on Products page (Store > Presentation Settings > Pagination settings : No)

    Then I tried making the pagination work manually on Products page by using your code :

    // Display 24 products per page. Goes in functions.php
    add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 );

    but it doesn't work.
    I also tried another code but it still won't work.

    $wpsc_count_products = 4;

    Do you know how I can display manually the number of products per page. And by not using shortcodes.

  4. Daniel Zimmermann
    Posted 2 years ago #

    ELGNAT THEMES!!!! Wragh....

    Thanks mattprice1707 for the solution ... I was searching for hours.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic