WPCS - WordPress Currency Switcher Professional

wpcs_price filter

Manipulation on the price by hook, for example rounding. Hook is in public function price().

add_filter('wpcs_price', function($price) {
       //http://stackoverflow.com/questions/11692770/rounding-to-nearest-50-cents
       //return $price = round($price * 2, 0) / 2;
       return round($price, 0, PHP_ROUND_HALF_EVEN);
});

or another example related to: https://wordpress.org/support/topic/how-can-i-round-the-prices
add_filter('wpcs_price', function ($price) {
    global $WPCS;
    
    //https://wp-currency.com/function/wpcs-current_currency
    if ($WPCS AND $WPCS->current_currency !== 'USD') {
        return $price = round($price / 100, 0) * 100;
    }

    return $price;
});