Shipping Director expressions help

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 years ago
Hey all,

I'm running a site on version 2.40. We ship throughout the UK, however there are certain postcode's that incur an additional delivery surcharge. Currently we handle this by including it in our FAQs, and then if a customer places an order to one of these postcodes we contact them and ask them politely to pay the additional charge- it's not a nice solution.

I've installed shipping director, but I can't really find any detailed documentation on how to write the rules. Im basically looking to write a couple of expressions which are as simple as:

If Postcode starts with "AB" Then Delivery Surcharge = £5.00
If Postcode starts with "FK" Then Delivery Surcharge = £12.00

Any help would be appreciated.

Regards,
Al
10 years ago
There's a lot of information and scenarios in the blogs.  For general info, start with the Getting Started blogs  (read from bottom up :)

See this blog about a basic surcharge expression (ignore that it's about a negative surcharge, you would just put in a positive amount)

In your case, your Surcharge Expression would also use the ternary if-then-else operator  ( " ? : " )

Decimal   Surcharge       ShippingAddress.ZipPostalCode.StartsWith("AB") ? 5.00 : 0
Decimal   Surcharge       ShippingAddress.ZipPostalCode.StartsWith("FK") ? 12.00 : 0

If you have many zips with the same rate, then rather than StartsWith, you could just look at first 2 chars with Substring, and and use Contains on a "list"

",AB,XX,YY,".Contains( ShippingAddress.ZipPostalCode.Substring(0,2) )


Then, just use just  [Surcharge]  in your surcharge expression of your Option records (similar to the negative surcharge blog above)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.