shopp_unit_conversion_table

filters the unit conversion table for the convert_unit() utility function.

add_filter( 'shopp_unit_conversion_table', [callback] )

@param array $table the unit conversion table for the convert_unit() utility function.

Description

filters the unit conversion table for the convert_unit() utility function.

Example

// register filter callback
add_filter('shopp_unit_conversion_table', 'shopp_unit_conversion_table_fltr');

// create filter function
function shopp_unit_conversion_table_fltr( $table ) {
    // Conversion table to International System of Units (SI)
    $table = array(
        'mass' => array(        // SI base unit "grams"
            'lb' => 453.59237, 'oz' => 28.349523125, 'g' => 1, 'kg' => 1000
        ),
        'dimension' => array(   // SI base unit "meters"
            'ft' => 0.3048, 'in' => 0.0254, 'mm' => 0.001, 'cm' => 0.01, 'm' => 1
        )
    );

    return $table;
}

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar