0
我正在开发一个新的woocommerce网站,并面临一个新问题,我没有在其他商店处理过。我需要将货币符号更改为标准以外的其他货币。在我的国家,这是DKK。我的自定义文本应该是“DKK /月”,但仅限于购物车(产品循环概览),而不是全部计算(结帐部分),因为例如运费不是/月,而且总计也不是。货币符号替换具体
以下代码在页面上无处不在,但它只需要在购物车清单/循环公关中。产品,并在收件产品列表中顺便说一句。
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
function change_existing_currency_symbol($currency_symbol, $currency) {
switch($currency) {
case 'DKK': $currency_symbol = 'kr. <span class="paymentType">/ month</span>'; break;
}
return $currency_symbol;
}
我该如何改变,只出现在购物车产品循环?
我曾尝试用:
if(is_cart()){
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
function change_existing_currency_symbol($currency_symbol, $currency) {
switch($currency) {
case 'DKK': $currency_symbol = 'kr. <span class="paymentType">/ month</span>'; break;
}
return $currency_symbol;
}
}
但不工作,我不知道这是这是正确的做法。 建议? :-)