Support » Plugin: Weight zone shipping for WooCommerce » Entering Decimal Values for Kg

  • Hey guys, thanks for the great plugin. I’m having a problem though as my store weights are listed in Kg. I try to enter them in the zone rates ( example: 0.025 | 3 | My Rate ) , but the editor sanitizes the input. So when I open it again, I see 0025 | 3 | My Rate.

    Is there any work around for this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi, goto to settings> Products> then weight, dropdownlist, make your choice.

    Good luck!

    Hans

    Thanks Hans, but I was wondering moreso if decimal values could be passed as weight by removing sanitization?

    I´m sorry I don´t understand. Will you send me the link for your website.?

    -Hans

    Hello,
    i found this solution, replace
    function get_value_as_decimal( $value )
    at line 540 of class-oik-weight-zone-shipping.php
    with this:

    function get_value_as_decimal( $value ) {
    				 
    		if(strpos($value, ",") !== false) {
    			$value = str_replace(".", "", $value); 
    			$value = str_replace(",", ".", $value); 
    		}
    		
    		if(preg_match("#([0-9\.]+)#", $value, $matchx)) { 
    			return floatval($matchx[0]) . "";
    		} else {
    			return floatval($value) . ""; 
    		}
    		
    	}

    it surely can be better with implementation of $this->decimal_separator

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Entering Decimal Values for Kg’ is closed to new replies.