0
votes

Would it be possible to have a php code to insert in my child theme capable of passing my site to two decimal places after the comma for all the basket information subtotal total VAT Shipping the same for the checkout but also in the customer area

I would like to keep only the product to three decimal after the decimal point but the total rounded up to two decimal after the decimal point

can you help me

I am using Change number of decimals in Woocommerce cart totals answer code, for the cart and the checkout pages. It works perfectly but I am missing an info for it to work in the my order account tab.

screenshot

1

1 Answers

1
votes

For my account section use the conditional tag is_account_page(), so in the code:

add_filter( 'wc_get_price_decimals', 'change_prices_decimals', 20, 1 );
function change_prices_decimals( $decimals ){
    if( is_cart() || is_checkout() || is_account_page() )
        $decimals = 2;
    return $decimals;
}

Code goes in functions.php file of the active child theme (or active theme). It should works.

Related: Change number of decimals in Woocommerce cart totals