我使用以下代码仅在产品页面上更改显示 get_price_html 但函数 is_product 在此过滤器中不起作用
add_filter( 'woocommerce_get_price_html','wpa83368_price_html',100,2 );
function wpa83368_price_html( $price,$product ){
if (is_product()) {
return '<div class="live-colst">'.$product->id.'</div>';
} else {
return $price;
}
}
是否有其他解决方案可以仅在产品页面上更改价格显示?