Support » Plugin: WooCommerce » Roundness sale or regular price

  • Hi, I have a lot of products (more than 7000) on my woocommerce database and i look for a solution to roundness all of my prices to x.99$ (exemple 5,44$ roundness to 5,99$). I don’t want to change it one by one (i will die before finish).

Viewing 1 replies (of 1 total)
  • Hey thanks for posting about your issue. For future items WooCommerce supports rounding natively if you set the number of decimals to 0 in the General Settings area. However, I don’t think woocommerce has a native option to round all of your current items.

    If you are a developer there are steps you can take to round the items.

    You will need to add the following code below to your functions.php file:

    add_filter("woocommerce_dynamic_pricing_get_decimals", "custom_woocommerce_dynamic_pricing_get_decimals");
    function custom_woocommerce_dynamic_pricing_get_decimals($decimals) {
    return 4;
    }

    Keep in mind that rounding to 4 decimal places but only showing 2 will result in an inconsistent display of the prices. If someone manually multiplies the displayed item total of 27.44 * 20 quantity they will get the 548.80 result, not the 548.73 that is actually being charged to the customer.

    Please take a look at the section where I got the code from for more information: Doc

    Hope this helps

Viewing 1 replies (of 1 total)
  • The topic ‘Roundness sale or regular price’ is closed to new replies.