• Resolved alanmj

    (@alanmj)


    Hi
    I have a issue in my shop page
    `/**
    * Change number of products that are displayed per page (shop page)
    */
    add_filter( ‘loop_shop_per_page’, ‘new_loop_shop_per_page’, 20 );

    function new_loop_shop_per_page( $cols ) {
    $cols = 24;
    return $cols;
    }
    I have used this code in my function.php It is showing random number of products per page. For Ex: In first it show 15 products on second page it shows only 2 products and go on. How to fix this issue ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support abwaita a11n

    (@abwaita)

    Hi @alanmj,

    Testing the function, I am able to get the site to show 24 products while running on the Twenty Twenty-One theme:

    add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );
    
    function new_loop_shop_per_page( $cols ) {
      $cols = 24;
      return $cols;
    }

    Thus, it might be that you have another tool interfering with this function on your site. Keep in mind that some themes have inbuilt controls to change the number of products displayed, which might be causing an issue.

    I’d first recommend checking whether this issue persists when on a default WordPress theme like Twenty Twenty-One with all plugins disabled apart from WooCommerce. Here’s the conflict test guide for reference – https://docs.woocommerce.com/document/how-to-test-for-conflicts/.

    If the issue is with your theme, you’ll want to check if it has any inbuilt controls to change the number of products on the shop page. Normally, you will find these controls in your Customizer → WooCommerce.

    Let us know how it goes.
    Thanks.

    Hi @alanmj

    We’ve not heard back from you in a while, so I’m marking this thread as resolved. If you have further questions, please feel free to open a new topic.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Products per page showing incorrect’ is closed to new replies.