Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Gariest

    (@gariest)

    Hello, it should be. If you find any bugs, please report it here. Thank you.
    Gariest.

    Gariest

    (@gariest)

    Hello, It would be possible with some freelance coding. If you are interested in, please contact me at [email protected]. Thanks!

    Thread Starter Gariest

    (@gariest)

    So, now this function looks like this

    function apply_rounding_rules($price, $currency = false ){
    
            global $woocommerce_wpml;
    
             $price= $this->float_number($price);
    
            if( !$currency )
    
            $currency = $this->get_client_currency();
    
            $currency_options = $woocommerce_wpml->settings['currency_options'][$currency];
    
            if($currency_options['rounding'] != 'disabled'){       
    
                if($currency_options['rounding_increment'] > 1){
    
                    $price  = $price / $currency_options['rounding_increment'];    
    
                }   
    
                switch($currency_options['rounding']){
    
                    case 'up':   
    
                        $rounded_price = ceil($price);
    
                        break;
    
                    case 'down':
    
                        $rounded_price = floor($price);
    
                        break;
    
                    case 'nearest':
    
                        if(version_compare(PHP_VERSION, '5.3.0') >= 0){
    
                            $rounded_price = round($price, 0, PHP_ROUND_HALF_UP);    
    
                        }else{
    
                            if($price - floor($price) < 0.5){
    
                                $rounded_price = floor($price);        
    
                            }else{
    
                                $rounded_price = ceil($price);                                
    
                            }
    
                        }
    
                        break;
    
                }
    
                if($rounded_price > 0){
    
                    $price = $rounded_price;
    
                }
    
                if($currency_options['rounding_increment'] > 1){
    
                    $price  = $price * $currency_options['rounding_increment'];    
    
                }   
    
            }
    
            if($currency_options['auto_subtract'] && $currency_options['auto_subtract'] < $price){
    
                $price = $price - $currency_options['auto_subtract'];
    
            }
    
            return $price;
    
        }

    Forum: Fixing WordPress
    In reply to: comments and spam

    Hello guys how did you solve that problem? Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)