WP / WooCommerce - 如何更改每页的默认产品数量?

时间:2017-12-17 17:01:00

标签: php mysql wordpress woocommerce shop

在我的商店里,我每页的产品数量设置为" 9"默认情况下,并不能通过使用插件来修改它。

网址:http://medicot.pl/sklep/

你知道我怎么能通过MySQL手动设置它或者在functions.php或类似的东西中设置重置脚本?

1 个答案:

答案 0 :(得分:3)

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.