How Do I Remove The Extra 1 Cent In Woocommerce Checkout?
I am having an issue whereby woocommerce add 1 cent extra on top of my stacked discount.
So my price is $100. I give 2 unique coupon with discount value of 10% each. Tax is 10% What happen is I expect user to pay $88. But eventually, there is an additional 0.01 cent.
I tried looking for solution here, but there don't seem to have any conclusion. The issue keeps resurfacing. So is there any way I can manipulate the price? Like after calculate total, how do I change the price before it reaches payment gateway?
Here is the link to the reported issues: https://github.com/woocommerce/woocommerce/issues/20997
Answer
I do not know where the problem comes from. But you can use this solution.
You can round the product price using Woocommerce
filter.
Copy this code in functions.php in your child theme:
add_filter('woocommerce_product_get_price', 'round_woocommrce_price', 99, 2);
add_filter('woocommerce_get_variation_regular_price', 'round_woocommrce_price', 99);
add_filter('woocommerce_get_variation_price', 'round_woocommrce_price', 99);
add_filter('raw_woocommerce_price', 'round_woocommrce_price' );
function round_woocommrce_price($price, $product = NULL) {
// you can return this, if you are interested: floor($price) + 0.99
return floor($price);
}
Related Questions
- → CORS missmatch because of http
- → Building sitemap for 2 wordpress install under 1 domain
- → How to remove empty elements after class?(jQuery)
- → Get width of an element and apply to another relative to the first one?
- → How to remove caption p class from wordpress?
- → 301 Redirection from no-www to www in wordpress
- → Laravel 5 routing using prefix
- → WordPress - Header position Top, Left &Right
- → how to add rel=nofollow to some specific external links in wordpress
- → octobercms install error: database is not empty?
- → How to edit the index page of wordpress theme?
- → How to select a Post Type (Wordpress) to pass a filter in head?
- → What sort of URL structure should be used to display AMP HTML vs vanilla HTML