diff --git a/vendor/magento/module-quote/Model/QuoteValidator.php b/vendor/magento/module-quote/Model/QuoteValidator.php index 87d010dee9524..afc1ecb0c6787 100644 --- a/vendor/magento/module-quote/Model/QuoteValidator.php +++ b/vendor/magento/module-quote/Model/QuoteValidator.php @@ -1,7 +1,7 @@ allowedCountryReader = $allowedCountryReader ?: ObjectManager::getInstance() ->get(AllowedCountries::class); @@ -69,7 +61,6 @@ public function __construct( ->get(OrderAmountValidationMessage::class); $this->quoteValidationRule = $quoteValidationRule ?: ObjectManager::getInstance() ->get(QuoteValidationRuleInterface::class); - $this->_response = $response ?: ObjectManager::getInstance()->get(RestResponse::class); } /** @@ -115,7 +106,6 @@ public function validateBeforeSubmit(QuoteEntity $quote) $defaultMessage .= ' %1'; } if ($defaultMessage) { - $this->_response->setHeader('errorRedirectAction', '#shipping'); throw new ValidatorException(__($defaultMessage, implode(' ', $messages))); } } diff --git a/vendor/magento/module-quote/Plugin/Webapi/Model/ErrorRedirectProcessor.php b/vendor/magento/module-quote/Plugin/Webapi/Model/ErrorRedirectProcessor.php new file mode 100644 index 0000000000000..321919a1c5eb0 --- /dev/null +++ b/vendor/magento/module-quote/Plugin/Webapi/Model/ErrorRedirectProcessor.php @@ -0,0 +1,43 @@ +restResponse->setHeader('errorRedirectAction', '#shipping'); + throw $e; + } + + return $result; + } +} diff --git a/vendor/magento/module-quote/etc/webapi_rest/di.xml b/vendor/magento/module-quote/etc/webapi_rest/di.xml index 85d8bafc23da7..55ea966b51708 100644 --- a/vendor/magento/module-quote/etc/webapi_rest/di.xml +++ b/vendor/magento/module-quote/etc/webapi_rest/di.xml @@ -1,8 +1,8 @@ @@ -20,4 +20,7 @@ + + +