/* 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(); $hotlistitems = getcollection(1234556789); $t = 0; $hasHotlistItems = false; foreach ($DATA['items'] as $item) { if (in_array($item['product_id'],$hotlistitems)) $hasHotlistItems = true; $t += $item['quantity']*$item['price']/100; } if ($t > 150 && !$hasHotlistItems) { $_RATES[] = array( "service_name" => 'Free Shipping', "service_code" => 'Free Shipping', "total_price" => 0, //in cents "currency" => "USD", ); } return $_RATES; /* do not edit below this line */ }