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

Rounding result coupon code percentage WordPress

  • SOLVED

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)

2016-03-21

Navjot Singh answers:

Try this solution: http://stackoverflow.com/a/27187767/772709


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:
http://hookr.io/plugins/woocommerce/#index=a

2016-03-21

2510506 answers:

please check pm


Robin Ferrari comments:

Where can i find pm?


2510506 comments:

pm = private message
http://wpquestions.com/account
have u found ?


Robin Ferrari comments:

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