diff --git a/lib/Config/Hooks.php b/lib/Config/Hooks.php index a0ec6d25b4..7cc1f0f331 100644 --- a/lib/Config/Hooks.php +++ b/lib/Config/Hooks.php @@ -157,6 +157,9 @@ class Hooks { } function setupWooCommerceSubscriptionEvents() { + if (!$this->settings->get('woo_commerce_list_sync_enabled')) { + return false; + } $woocommerce = $this->settings->get('woocommerce', []); // WooCommerce: subscribe on checkout diff --git a/tests/acceptance/WooCommerceSettingsTabCest.php b/tests/acceptance/WooCommerceSettingsTabCest.php index 77eb4e029d..d9cc12e370 100644 --- a/tests/acceptance/WooCommerceSettingsTabCest.php +++ b/tests/acceptance/WooCommerceSettingsTabCest.php @@ -2,10 +2,17 @@ namespace MailPoet\Test\Acceptance; +require_once __DIR__ . '/../DataFactories/Settings.php'; + +use MailPoet\Test\DataFactories\Settings; + class WooCommerceSettingsTabCest { function _before(\AcceptanceTester $I) { $I->activateWooCommerce(); + $this->settings_factory = new Settings(); + $this->settings_factory->withWooCommerceListImportPageDisplayed(true); + $this->settings_factory->withWooCommerceListSyncEnabled(); } function checkWooCommerceTabExists(\AcceptanceTester $I) { diff --git a/tests/integration/WooCommerce/SubscriptionTest.php b/tests/integration/WooCommerce/SubscriptionTest.php index 6650c9e7b9..24eea6d7fc 100644 --- a/tests/integration/WooCommerce/SubscriptionTest.php +++ b/tests/integration/WooCommerce/SubscriptionTest.php @@ -15,6 +15,7 @@ class SubscriptionTest extends \MailPoetTest { $this->order_id = 123; // dummy $this->subscription = ContainerWrapper::getInstance()->get(Subscription::class); $this->settings = new SettingsController(); + $this->settings->set('woo_commerce_list_sync_enabled', 1); $this->wc_segment = Segment::getWooCommerceSegment(); $subscriber = Subscriber::create(); diff --git a/views/settings/woocommerce.html b/views/settings/woocommerce.html index 003f561ba5..e1f305a584 100644 --- a/views/settings/woocommerce.html +++ b/views/settings/woocommerce.html @@ -1,4 +1,5 @@