public function applyItemTaxRate(Item $item) { $order = $item->Order(); // Orders shipped within New Zealand have tax applied if ($order && $order->exists() && $order->ShippingCountryCode == 'NZ') { $item->XeroTaxType = 'OUTPUT2'; $item->XeroTaxRate = 15.0; } else { $item->XeroTaxType = 'NONE'; $item->XeroTaxRate = 0.0; } $item->write(); }