Override decimal places in the cart
You need to paste this code in the functions.php of your theme.
For cart and checkout page:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function adp_set_decimals(){ return 3; } add_action("woocommerce_before_cart", function(){ add_filter("wc_get_price_decimals","adp_set_decimals",123); }); add_action("woocommerce_review_order_before_cart_contents", function(){ add_filter("wc_get_price_decimals","adp_set_decimals",123); }); add_action("woocommerce_after_cart", function(){ remove_filter("wc_get_price_decimals","adp_set_decimals",123); }); add_action("woocommerce_review_order_after_order_total", function(){ remove_filter("wc_get_price_decimals","adp_set_decimals",123); }); |
For mini-cart:
1 2 3 4 5 6 7 8 9 |
function adp_set_decimals(){ return 3; } add_action("woocommerce_before_mini_cart", function(){ add_filter("wc_get_price_decimals","adp_set_decimals",123); }); add_action("woocommerce_after_mini_cart", function(){ remove_filter("wc_get_price_decimals","adp_set_decimals",123); }); |