2017-02-17 125 views
1

我想顯示不是銷售的產品意味着只有普通產品。排除銷售產品。如何顯示WooCommerce產品未銷售?

IN WooCommerce我的頁面只顯示常規產品。所以任何人都可以告訴我該怎麼做。

+0

想刪除添加到購物車按鈕並且只顯示產品數據? –

+0

我想展示所有產品,但不想展示正在出售的產品。 – Manish

回答

0

我管理濾除WITHOUT SALE產品()have_posts()位於下方的正上方,如果代碼:

的$ args =陣列(

'post_type'  => 'product', 

'meta_query'  => array(

    'relation' => 'OR', 

    array(// Simple products type 

     'key'   => '_sale_price', 

     'value'   => 0, 

     'compare'  => '=', 

     'type'   => 'numeric' 

    ), 

    array(// Variable products type 

     'key'   => '_min_variation_sale_price', 

     'value'   => 0, 

     'compare'  => '=', 

     'type'   => 'numeric' 

    ) 
) 

);

query_posts($ args);

代碼放在archive-product.php的一個副本中,我將其重命名爲archive-product_withoutsale.php並作爲頁面模板。

相關問題