loggerFactory = $loggerFactory; $this->logger = $this->loggerFactory->create(); } /** * Around plugin for Tax::collect * * @param TaxCollector $subject * @param callable $proceed * @param Quote $quote * @param ShippingAssignmentInterface $shippingAssignment * @param QuoteTotal $total * @return TaxCollector */ public function aroundCollect( TaxCollector $subject, callable $proceed, Quote $quote, ShippingAssignmentInterface $shippingAssignment, QuoteTotal $total ) { $netsuiteOrderId = $quote->getData('netsuite_order_id'); if ($netsuiteOrderId !== null) { $this->logger->info("This quote generated from NS order $netsuiteOrderId, skipping tax calculation."); // zero out tax on totals $total->setTotalAmount('tax', 0); $total->setBaseTotalAmount('tax', 0); // zero out tax on each item in the shipping assignment foreach ($shippingAssignment->getItems() as $item) { $item->setTaxAmount(0); $item->setBaseTaxAmount(0); $item->setTaxPercent(0); } return $subject; } return $proceed($quote, $shippingAssignment, $total); } }