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