如何解决Woocommerce在产品页面上隐藏前缀
我使用代码段在价格之前添加了前缀。效果很好,但我只想在类别产品页面上显示它。
我想在简单的产品页面上隐藏前缀。
你能帮我吗?
谢谢!
使用的摘要:
add_filter( ‘woocommerce_get_price_html’,‘njengah_text_before_price’ );
function njengah_text_before_price($price){
global $post;
$product_id = $post->ID;
$product_array = array( 25338 );//add in the product IDs to add text after price
if ( in_array( $product_id,$product_array )) {
$text_to_add_before_price = ‘ Cena od ‘; //change text in bracket to your preferred text
return $text_to_add_before_price . $price ;
}else{
return $price;
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。