I'm trying to modify a shipping module to add a surcharge onto the shipping cost if certain postcodes are used.

For example, if someone enters: 'nn128bn' I want to add a £10 surcharge instead of the standard £7.50.

I need to trim the last 3 characters of the end to leave me with 'nn12'

Looking at the PHP documentation I have:

if (substr($postcode, 0, -3) == 'nn12') $base = 10;
where $postcode is the postcode from the customers details (ie: $order->delivery['postcode'])


However, $base is always coming up as the default value set previously and not changing to 10

Any ideas what's wrong?? Is it the 'substr' bit or am I using the wrong variable for the postcode?

Cheers in advance.