how to round up the price in wordpress?

woocommerce, wordpress

Solution

You can try this on your theme `functions.php` without altering your data :

add_filter( 'woocommerce_get_price_excluding_tax', 'round_price_product', 10, 1 );
add_filter( 'woocommerce_get_price_including_tax', 'round_price_product', 10, 1 );
add_filter( 'woocommerce_tax_round', 'round_price_product', 10, 1);
add_filter( 'woocommerce_get_price', 'round_price_product', 10, 1);

function round_price_product( $price ){
    // Return rounded price
    return ceil( $price );
}

Problem

I am using woocommerce plugin version 2.2.8 for my eCommerce site. Product prices in my site looks like (Rs 880.64/-). I need to round up this price to Rs 881/-. Is there is any way to do that..? For Eg: Product1 = Rs 880.64 (includes tax rate). It should converted to nearest decimal value.

Original source