Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Rounding result coupon code percentage WordPress


Hello I add a promotional code with a discount in % of the cart ( 25%). When I apply the coupon code the price of the cart pass 12.50 to 9.38 . How to round the new amount ? in this case: 9.40

Answers (2)


Navjot Singh answers:

Try this solution:

Robin Ferrari comments:

Ok this solution work for me

Robin Ferrari comments:

Ohh shit, i don't see but it's doesn't round the price of coupon code, it's round the price of product only...

Robin Ferrari comments:

Finally i find a solution by myself but thank's you help me with your response:

my solution:

add_filter( 'woocommerce_coupon_get_discount_amount', 'round_price_product', 10, 1 );
function round_price_product( $price ){
// Return rounded price
return round( $price, 1, PHP_ROUND_HALF_UP);

Robin Ferrari comments:

This website was usefull for me:


2510506 answers:

please check pm

Robin Ferrari comments:

Where can i find pm?


pm = private message
have u found ?

Robin Ferrari comments:

ok i see now, but sorry Navjot Singh have resolve my problem