Change the Carrier on an Order in FedEx's Zone 2

This is a specific script example for changing the carrier for unique zones assigned by a carrier.

Use this script to change the carrier for any order that's shipping to a ZIP code that's included in FedEx's "Zone 2".


For example, in the script below we are using a hash map that includes the first 3 digits of all possible ZIP codes in Zone 2.  Whenever an order comes across with a Ship To ZIP code whose first 3 digits matches one of the ZIP codes in zone 2, change the carrier to carrierId 7000 (FedEx Ground).  If it doesn't match, therefore not being in zone 2, change the carrier to carrierId 7002 (FedEx 2-Day).  


This script can be adapted to include other zones and carriers.