/**
* 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;
}
Sets the Number of Products Displayed
Sets the number of products displayed per page in the WooCommerce shop.