getEvent()->getQuote(); if (!$quote instanceof Quote || !(int)$quote->getStoreId()) { return; } $address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress(); $context = $this->resolver->resolve( (int)$quote->getStoreId(), (int)$quote->getCustomerId(), (string)$address->getCountryId() ); $vat = $context->vatApplication; $quote->addData([ 'esun_vat_id' => $vat ? (int)$vat->getId() : null, 'esun_vat_number' => $vat ? (string)$vat->getData('vat_number') : null, 'esun_vat_country_id' => $vat ? (string)$vat->getData('country_id') : null, 'esun_vat_company_name' => $vat ? (string)$vat->getData('company_name') : null, 'esun_vat_exempt' => $context->exempt ? 1 : 0, 'esun_nominal_tax_rate' => $context->nominalRate, 'esun_tax_mode' => $context->mode, ]); } }