diff --git a/Block/Checkout/Success.php b/Block/Checkout/Success.php new file mode 100644 index 000000000..3a4bf6896 --- /dev/null +++ b/Block/Checkout/Success.php @@ -0,0 +1,70 @@ +productMetadata = $productMetadata; + } + + /** + * @return bool + */ + public function isAllowInvalidateQuote() + { + // Workaround for known magento issue - https://github.com/magento/magento2/issues/12504 + return (bool) (version_compare($this->getMagentoVersion(), '2.2.0', '<')); + } + + /** + * Get magento version + * + * @return string + */ + private function getMagentoVersion() + { + return $this->productMetadata->getVersion(); + } +} diff --git a/Plugin/ClearQuote.php b/Plugin/ClearQuote.php new file mode 100644 index 000000000..007162ac0 --- /dev/null +++ b/Plugin/ClearQuote.php @@ -0,0 +1,41 @@ +setLoadInactive(false); + $subject->replaceQuote($subject->getQuote()->save()); + + return $subject; + } +} diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index fa234a887..eb42629e0 100644 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -32,4 +32,7 @@ Magento\Checkout\Model\Session + + + diff --git a/view/frontend/layout/checkout_onepage_success.xml b/view/frontend/layout/checkout_onepage_success.xml new file mode 100644 index 000000000..4dd5d15dd --- /dev/null +++ b/view/frontend/layout/checkout_onepage_success.xml @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/view/frontend/templates/checkout/success.phtml b/view/frontend/templates/checkout/success.phtml new file mode 100644 index 000000000..5c82b82eb --- /dev/null +++ b/view/frontend/templates/checkout/success.phtml @@ -0,0 +1,11 @@ + +isAllowInvalidateQuote()): ?> + +