问题描述
我使用代码段在价格之前添加了前缀。效果很好,但我只想在类别产品页面上显示它。
我想在简单的产品页面上隐藏前缀。
你能帮我吗?
谢谢!
使用的摘要:
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 (将#修改为@)