问题描述
您能帮我解决一下如何自定义以下已添加到wordpress / Woocommerce的代码的输出吗?我希望将返回值(常规价格和销售价格)用千位后的小数点分隔符(点)分隔,例如“ 1.200”。
代码:
function sr_change_variable_price($price,$product){
$html_tag = '<span id="reg_price">%s</span><span id="sale_price">%s</span>';
if($product->is_type('variable') AND !is_product()){
$test = $product->get_variation_regular_price('min') . ' Ft' ;
$min = $product->get_variation_sale_price('min') . ' Ft';
return(sprintf($html_tag,$test,$min));
}elseif($product->is_type('variable') AND is_product()){
return('');
}else
{return $price; // other cases
}
}
add_filter('woocommerce_get_price_html','sr_change_variable_price',10,2);
非常感谢您的帮助