shopp_map_{country}_postcode

called after a post-code has been verified to match the pattern for the country.

add_action('shopp_map_{country}_postcode', [callback])

@param Address $Address the Address object that the post-code is being tested on.

Description

called after a post-code has been verified to match the pattern for the country.

This action will only be called if the country and postal code matches one of the Postcode Patterns specified in Shopp’s lookup table.

This action might be used to automatically lookup address information from the post-codes lookup table, or from an address service, or your own lookup table.

Example

add_action('shopp_map_gb_postcode', 'map_gb_postcode_action');
function map_gb_postcode_action( &$Address ) {
    // primative lookup table
    $table = array('UB8 2YF' => array('city'=>'Uxbridge','zone'=>'Middlesex'));

    if ( in_array($Address->postcode, array_keys($table)) ) {
        $Address->city = $table[$Address->postcode]['city'];
        $Address->state = $table[$Address->postcode]['zone'];       
    }
}

See Also

You must be logged in to post a comment.

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

Skip to toolbar