Magento – Some partial UK postcodes table rates are not being recognised

deliverymagento-1.8table-rates

My first post here so greetings to all!

I have an issue with table rates not applying the correct delivery charge to certain partial UK postcodes. It seems to affect UK postcodes where both alpha and numeric characters are used.

For example, my rate for BT postcodes is:

GBR * BT 8.33 25

Which correctly applys a £25 surcharge to orders £10 or over for any postcode starting with BT (e.g. BT31 2NR)

However my rate for TR21 postcodes doesn't work:

GBR * TR21 8.33 13

I have 9 rates for alpha only postcodes that all work and 16 rates for alphanumeric postcodes, none of which work. If I change the alphanumeric to alpha it works (e.g. change TR21 to TR) so it does seem to be related to the alphanumeric nature of the postcode.

I need to use alphanumeric as my courier surcharges on certain areas – TR21 for example is the Scilly Isles – and the TR postcode covers all of southwest Cornwall where there is no surcharge, hence I only want TR21 to apply the surcharge.

Can anyone give me any advice on how to get alphanumeric UK postcodes to work on table rates?

Thanks!

Best Answer

I think that the Magento built in shipping methods are always going to be only so good for UK postcodes. Not many people put the space in the correct place and few use block capitals, consequently you always have to fettle the postcode to get the part you want.

Given this you may want to consider writing your own shipping module. Most of the framework from a regular shipping module will suffice, as for the code inside, you want to consider having different 'bands', e.g. London weighting for the congestion charge, price for Scilly Isles and dependencies such as IoM, price for the outer Hebridies and then you main, general UK rate.

For the system configuration for your custom shipping method you can get multiselect boxes for each zone, then have a custom source that is just the UK postcodes (first part). This is a manageable list.

Each zone can have a rate and some text - name of the zone. This can get pulled through to the checkout. The code for the module simply takes the delivery postcode, makes the space to be in the correct place, takes the first part of the postcode and then goes through the zones until a match is found. Then the corresponding rate is returned.

Getting your custom module to work with 'free shipping' promotions will require more work, however, it may be simpler to put your own module together with the logic you need rather than struggle with built in shipping methods and messy spreadsheets.