我正在忙于一个wordpress/woocommerce网站,我想在产品类别/存档页面上隐藏商品的价格为零。
我试着在web和php文件中查找,但是找不到我应该在哪里添加if语句。
我的php知识相当有限。我想知道是否有人有这方面的经验,或者能以正确的方式帮助我。
谢谢!
发布于 2021-03-29 22:00:14
!is_admin()
add_filter( 'woocommerce_get_price_html','maybe_hide_price',10,2);
function maybe_hide_price($price_html, $product){
if( $product->get_price() == 0 && !is_admin() ){
return ''; //or return 'Any text'
}
return $price_html;
} https://stackoverflow.com/questions/29569046
复制相似问题