English 中文(简体)
w 商业产品图书馆的数量和违约商店页数 Can
原标题:The number of woocommerce product libraries and the number of default shop pages Can t match

w 商业产品图书馆的数量和违约商店页数 Can

我的所有产品都显示350多种产品,但商店网页上只展示270种产品,迄今为止还没有找到解决办法。

我试图利用ook光功能重塑和展示所有展览,但似乎没有任何效果。 使用q子盘问产品也显示270

$args = array(
     post_type       =>  product ,
     post_status     =>  publish ,
     posts_per_page  => -1, // all product
);

$products = new WP_Query( $args );
$i=0;
if ( $products->have_posts() ) {
    while ( $products->have_posts() ) {
        $products->the_post();

     $i++;
  
    }   
    echo  Product—sum: .$i;
}


function show_all_products_on_shop_page($query) {
    if (is_admin() || ! $query->is_main_query()) {
        return;
    }

    if (is_shop()) {
        $query->set( posts_per_page , -1);
    }
}
add_action( pre_get_posts ,  show_all_products_on_shop_page );

Using the above two methods does not seem to workenter image description here enter image description here

问题回答

暂无回答




相关问题
Remove shipping for specific products in WooCommerce

I am looking to remove the shipping from few variable products in WooCommerce. I need that few products from cart directly go to PayPal. I added the following code in my theme s functions.php file: ...

Call a function after geolocalization in Woocommerce

I am using the plugin FOX – Currency Switcher Professional for WooCommerce (former name is WOOCS) and everything was working smoothly. Then I have installed a budgeter plugin. Unfortunately, it is not ...

Woocommerce Dynamic Custom Price not updating in checkout

I m trying to update a custom price in checkout via a Woocommerce action hook. I m storing my dynamic price in Session variable. But when I used session variable in hook functions, it shows up on the ...

FiboSearch plugin Woocommerce

Would you please help me adding a Scroll of a result while I am using Fibosearch plugin woocommerce ? I tried to get the ID of the item that is a wrapper for the product list but I could not. I ll be ...

hide button class from logged out user woo commerce

hide button class = "vc_button" from logged out user woocommerce I have tried .logged-out .vc_button{ display: none; } & <?php if ( is_user_logged_in() ) { echo Welcome, ...

热门标签