价格woocommerce中的十进制分隔符 [英] Decimal Separator in price woocommerce
本文介绍了价格woocommerce中的十进制分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我的 woocommerce 中有这个配置
Hi everyone I have this configuration in my woocommerce
在我的产品中,我有这个
And in my product I have this
但是当我显示价格时它返回4.95"而不是4,95"
but when I show the price it return me "4.95" instead of "4,95"
我用这个来获取价格
$price = get_post_meta( get_the_ID(), '_regular_price', true);
任何想法!
推荐答案
使用 wc_price
函数格式化数字.
Use the wc_price
function to format the number.
$price = get_post_meta( get_the_ID(), '_regular_price', true);
$formatted_price = wc_price( $price );
注意:对于版本<2.1.0,使用woocommerce_price
.
这篇关于价格woocommerce中的十进制分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文