wordpress/woocommerce: Remove price if zero

前端 未结 5 1623
庸人自扰
庸人自扰 2021-02-04 22:38

I\'m busy with a wordpress/woocommerce site and I\'d like to hide the price of an item when it\'s zero on the product category/archive page.

I\'ve tried looking on the

5条回答
  •  被撕碎了的回忆
    2021-02-04 22:57

    Here's another approach:

    add_filter( 'woocommerce_get_price_html','maybe_hide_price',10,2);
    function maybe_hide_price($price_html, $product){
         if($product->get_price()>0){
              return $price_html;
         }
         return '';
     }
    

提交回复
热议问题