/* This macro will be parsed as PHP code (see http://www.php.net) The calculateshipping function is called every time a shipping calculation request is made by Shopify. The function must return an array of available shipping options, otherwise no shipping options will be returned to your customers. */ function calculateshipping($DATA) { /* do not edit above this line */ $_RATES = array(); $postcodelist = array_merge(array(91210,91211,91212),range(10001,10010)); //an array of zipcodes 91210,91211,91212,10001,10002,10003,10004,10005,10006,10007,10008,10009,10010 //convert the dest postcode to a int to match types $pc = intval(trim($DATA['destination']['postal_code'])); //produce rate if customer is in $postcodelist if (in_array($pc,$postcodelist)) { $_RATES[] = array( "service_name" => 'Standard Shipping', "service_code" => 'STANDARD', "total_price" => 1000, //in cents "currency" => "USD", ); } return $_RATES; /* do not edit below this line */ }