woocs_raw_woocommerce_price
Use this hook to manipulate by price values, for example rounding price by your own logic.
Examples:
- https://currency-switcher.com/how-to-round-price-to-50-cents/ – rounding price to the nearest 50 cents
add_filter('woocs_raw_woocommerce_price', function($price) { return round($price * 2, 0) / 2; });
- https://currency-switcher.com/round-prices-500/ – How to round prices to 500
add_filter('woocs_raw_woocommerce_price', function($price) { global $WOOCS; /* if ($WOOCS->current_currency === 'USD') { $price = round($price + 0.01) - 0.01; } */ if (($price <= 1000)) { $price = round($price / 1000, 0) * 1000; return $price; } else { $price = ceil($price / 500) * 500; return $price; } });
- https://currency-switcher.com/how-to-round-price-to-99-cents/ – How to round prices to x.99
Also read: https://currency-switcher.com/hook/woocs_woocommerce_variation_prices/