我正在使用瑞典克朗(SEK)作为货币在WordPress中创建一个使用WooCommerce的网上商店 . 它应该在价格之后显示,即“2999 kr”,而不是“kr2999”,但我不能让它在购物车和结账页面上工作,而不是在 Headers 中的购物车 .

我找到了这个过滤器的总价格,这是有效的,但只在结帐时的总价格:

的functions.php

add_filter('woocommerce_cart_totals_order_total_html', 'total_price');

function total_price() {
    $price_html = substr(WC()->cart->get_total(),33);
    $replace_price = substr_replace($price_html, ' kr', 49);
    $value = '<strong>' . $replace_price . '</strong> ';
    return $value;
}

如何在购物车和结帐中的每个价格显示和 Headers 中的购物车中执行此操作?它应该类似于上面的代码?

Header cart price display