Back to PhocacartUtils class

Method convertWeightFromKg

public static
convertWeightFromKg
(mixed $weight, mixed $unit)

Method convertWeightFromKg - Source code

public static function convertWeightFromKg($weight, $unit)
{
    if ($unit == 'kg') {
        return $weight;
    } else {
        if ($unit == 'g') {
            return $weight * 1000;
        } else {
            if ($unit == 'lb') {
                return $weight / 0.45359237;
            } else {
                if ($unit == 'oz') {
                    return $weight / 0.0283495231;
                } else {
                    return $weight;
                }
            }
        }
    }
}