shopp_fedex_residential

filters the residential address flag in the FedExRates module.

add_filter( 'shopp_fedex_residential', [callback] )

@param bool $residential true when the address is residential, false when the address is commercial
@param Address $Shipping the shipping Address object

Description

filters the residential address flag in the FedExRates module.

When this filter returns true, the FedExRates module will indicate that the address is residential when looking up shipping rate estimates. When this filter returns ture, the FedExRates module will ask for non-residential shipping rate estimates.

For “Ground” estimates, FedEx will provide FedEx Home Delivery for residential addresses and FedEx Ground for commercial addresses. Your customer can specify if their address is residential if you add the shopp(‘checkout’,’residential-shipping-address’) theme api call to your checkout.php template.

Example

/**
 * Can be written by a programmer to set the FedEx residential flag. If the residential flag is not set, the FedEx module assumes all addresses are residential.
 * 
 * @param boolean $residential the original value; true if currently set to residential, false if commercial
 * @param ShippingAddress $Address the address in question.
 * @return boolean true if the address is residential, false if the address is commercial
 **/
function shopp_fedex_override_residential ( $residential, $Address ) {
    // always assume commerical
    return false;
}

// standard WordPress filter callback
add_filter('shopp_fedex_residential', 'shopp_fedex_override_residential', 10, 2);

Switch the default behavior to commercial addresses when not set

function shopp_fedex_default_commercial ( $residential, $Address ) {
    // when the flag is not set assume it is not residential
    if ( ! isset($Address->residential) ) return false;
    return $residential;
}

// standard WordPress filter callback
add_filter('shopp_fedex_residential', 'shopp_fedex_default_commercial', 10, 2);

See Also

You must be logged in to post a comment.

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

Skip to toolbar