简体   繁体   中英

WP/WooCommerce - How to change default product per page count?

On my shop I have number of products per page set as "9" by default and couldn't really modify it by the use of plugins.

URL: http://medicot.pl/sklep/

Do you have any idea how can I either set it manually via MySQL or put a reset script in functions.php or something like that?

The best way to modify the woocmmerce pages is hooks it provides. Please check the following code :

add_filter( 'loop_shop_per_page', 'perpage_shop_products', 20 );
function perpage_shop_products()
{
    $product_per_page=10; //change according to your need
    return $product_per_page;
}

The function will change the per page count to 10, please change according to your need. Or implement logic for it as per your need.

Hope it works for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM