diff --git a/Helper/Data.php b/Helper/Data.php
index 22a716f..8abb5dd 100644
--- a/Helper/Data.php
+++ b/Helper/Data.php
@@ -18,6 +18,7 @@ public function getConfigValue()
return [
'show_frontend_as' => $this->scopeConfig->getValue('admin/disable_frontend/show_frontend_as', ScopeInterface::SCOPE_WEBSITE),
'redirect_to' => $this->scopeConfig->getValue('admin/disable_frontend/redirect_to', ScopeInterface::SCOPE_WEBSITE),
+ 'allow_checkout' => $this->scopeConfig->getValue('admin/disable_frontend/allow_checkout', ScopeInterface::SCOPE_WEBSITE),
];
}
diff --git a/Observer/DisableFrontend.php b/Observer/DisableFrontend.php
index 90fc429..e34aba1 100644
--- a/Observer/DisableFrontend.php
+++ b/Observer/DisableFrontend.php
@@ -65,16 +65,19 @@ public function __construct(
*/
public function execute(Observer $observer)
{
- $controller = $observer->getControllerAction();
- $destination = $controller->getResponse();
$configValues = $this->disableFrontendHelper->getConfigValue();
- // Allow requests to the cart to get through.
- $request = $observer->getRequest();
- if ($request->getRouteName() === 'cart') {
- return;
+ if ($configValues['allow_checkout']) {
+ // Allow requests to the cart and checkout to get through.
+ $request = $observer->getRequest();
+ if ($request->getRouteName() == 'cart' || $request->getRouteName() == 'checkout') {
+ return;
+ }
}
+ $controller = $observer->getControllerAction();
+ $destination = $controller->getResponse();
+
// Shows a blank page if all else fails.
$this->_actionFlag->set('', Action::FLAG_NO_DISPATCH, true);
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 24c13af..9a6994f 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -12,6 +12,9 @@
validate-url
+
+
+