Back to PhocacartUtils class

Method convertWeightToKg

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

Method convertWeightToKg - Source code

public static function convertWeightToKg($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;
                }
            }
        }
    }
}