/* 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(); $DATA = enrichCartDetails($DATA); $wholesaleTags = array('VIP'); //list of customer tags considered wholesale, case sensitive $isWholesale = false; if (isset($DATA['cart']['customer']['tags'])) { foreach ($wholesaleTags as $tag) { if (in_array($tag,$DATA['cart']['customer']['tags'])) { $isWholesale = true; } } } if ($isWholesale) { $_RATES[] = array( "service_name" => 'Wholesale Shipping', "service_code" => 'Wholesale Shipping', "total_price" => 1000, "currency" => "USD", ); } else { $_RATES[] = array( "service_name" => 'Retail Shipping', "service_code" => 'Retail Shipping', "total_price" => 0, "currency" => "USD", ); } return $_RATES; /* do not edit below this line */ }