shopp_shipping_carriers

filters the shipping carriers lookup table of ShippingCarrier objects.

add_filter( 'shopp_shipping_carriers', [callback] )

@param array $carriers shipping carriers lookup table of ShippingCarrier objects.

Description

filters the shipping carriers lookup table of ShippingCarrier objects.

Example

// register filter callback
add_filter('shopp_shipping_carriers', 'shopp_shipping_carriers_filter');

// create filter function
function shopp_shipping_carriers_filter( $carriers ) {
    $carriers['ups'] = new ShippingCarrier(
        'UPS', // carrier name
        'http://ups.com/', // carrier website
        '*', // carrier's operating countries (* for all)

        // tracking number replacement string
        'http://forwarding.ups-scs.com/tracking/trackformaction.asp?optTYPE=SHIPNUM&PRO1=%s',
        '/^(1Z[0-9A-Z]{16}|[\dT]\d{10})$/' // tracking number regex pattern
        );

    $carriers['auspost'] = new ShippingCarrier(
        'Australia Post', // carrier name
        'http://auspost.com.au/', // carrier website
        'AU', // two digit alpha ISO country code

        // tracking number replacement string
        'http://auspost.com.au/track/track.html?trackIds=%s',

        '/^(Z|[A-Z]{2}[A-Z0-9]{9}[A-Z]{2})/' // tracking number regex pattern
        );

    return $carriers;
}

See Also

You must be logged in to post a comment.

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

Skip to toolbar