/** * Add error message for invalid VAT ID * * @param Address $customerAddress * @return $this */ protected function addInvalidMessage($customerAddress) { $vatId = $this->escaper->escapeHtml($customerAddress->getVatId()); $message = [(string) __('The VAT ID entered (%1) is not a valid VAT ID.', $vatId)]; $customer = $customerAddress->getCustomer(); if (!$this->scopeConfig->isSetFlag(HelperAddress::XML_PATH_VIV_DISABLE_AUTO_ASSIGN_DEFAULT) && !$customer->getDisableAutoGroupChange()) { $message[] = (string) __('You will be charged tax.'); } $this->messageManager->addError(implode(' ', $message)); return $this; }