diff --git a/Block/Checkout/Success.php b/Block/Checkout/Success.php index 2214aa8c..8402a956 100644 --- a/Block/Checkout/Success.php +++ b/Block/Checkout/Success.php @@ -30,6 +30,10 @@ class Success extends \Magento\Framework\View\Element\Template * @var \Ebizmarts\MailChimp\Model\MailChimpInterestGroupFactory */ protected $_interestGroupFactory; + /** + * @var \Magento\Framework\View\Element\Template\Context + */ + protected $_context; /** * Success constructor. @@ -54,6 +58,7 @@ public function __construct( $this->_helper = $helper; $this->_subscriberFactory = $subscriberFactory; $this->_interestGroupFactory= $interestGroupFactory; + $this->_context = $context; } public function getInterest() @@ -88,4 +93,11 @@ public function getFormUrl() $order = $this->_checkoutSession->getLastRealOrder(); return $this->_helper->getSuccessInterestUrl($order->getStoreId()); } + public function _toHtml() + { + if (!$this->_helper->isMailChimpEnabled($this->_context->getStoreManager()->getStore()->getId())) { + return ""; + } + return parent::_toHtml(); + } } diff --git a/view/frontend/layout/default.xml b/view/frontend/layout/default.xml index 87a12d62..46070a26 100644 --- a/view/frontend/layout/default.xml +++ b/view/frontend/layout/default.xml @@ -14,7 +14,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">