Sets the Number of Products Displayed

Sets the number of products displayed per page in the WooCommerce shop.

PHP
/**
 * Snippet Name:     Sets the number of products displayed
 * Snippet Author:   coding-bunny.com
 * Description:      Sets the number of products displayed per page in the WooCommerce shop.
 */

if ( class_exists( 'WooCommerce' ) ) {
    add_filter( 'loop_shop_per_page', 'cb_set_products_per_page', 9999 );
}

/**
 * Set the number of products displayed per page in WooCommerce.
 *
 * @param int $products_per_page Current number of products per page.
 * @return int Modified number of products per page.
 */
function cb_set_products_per_page( $products_per_page ) {
    // Set the number of products per page to 16
    return 16;
}

How To Implement This Solution?

Leave a Reply

Your email address will not be published. Required fields are marked *

My Agile Privacy
This site uses technical and profiling cookies. You can accept, decline or customize cookies by pressing the desired buttons. By closing this policy you will continue without accepting.

Need help?

Choose one of the following options:

Powered by CodingBunny