shopp_packager_options

filters the options array passed to the shipping packager constructor.

add_filter( 'shopp_packager_options', [callback] )

@param array $options the options array passed to the shipping packager constructor.
@param string $module the classname of the shipping module

Description

filters the options array passed to the shipping packager constructor.

Examples

// register filter callback
add_filter('shopp_packager_options', 'shopp_packager_options_fltr', 10, 2);

// create filter function
function shopp_packager_options_fltr( $options, $class ) {
    // force all Items shipped by FedEx to ship 
    // together only calculating weight.
    // also, limit weight to 50 units
    if ( 'FedexRates' == $class ) {
        $options['type'] = 'mass';
        if ( isset($options['limits']) )
            $options['limits']['wtl'] = 50; 
    }

    // force all Items shipped by UPS to ship
    // separately
    if ( 'UPSServiceRates' == $class ) {
        $options['type'] = 'piece';
    }
    return $options;
}
// register filter callback
add_filter('shopp_packager_options', 'shopp_package_limits');

// create filter function
function shopp_package_limits( $options ) {
    // Set package limits for all real-time rate modules that use packager
    $options['limits'] = array(
        'wtl'   => 50, // 50 lbs weight limit
        'wl'    => 20, // 20" width limit
        'll'    => 30, // 30" length limit
        'hl'    => 40, // 40" height limit
    );
    return $options;
}

See Also

You must be logged in to post a comment.

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

Skip to toolbar