y $blocks) { $blocks[] = 'mailpoet/marketing-optin-block'; return $blocks; } public function extendRestApi() { if (!$this->settings->get('woocommerce.optin_on_checkout.enabled', false)) { return; } $extend = StoreApi::container()->get(ExtendSchema::class); $extend->register_endpoint_data( [ 'endpoint' => CheckoutSchema::IDENTIFIER, 'namespace' => 'mailpoet', 'schema_callback' => function () { return [ 'optin' => [ 'description' => __('Subscribe to marketing opt-in.', 'mailpoet'), 'type' => ['boolean', 'null'], ], ]; }, ] ); $this->unregisterAutomateWooCheckoutApiEndpoint(); } public function unregisterAutomateWooCheckoutApiEndpoint() { $extend = StoreApi::container()->get(ExtendSchema::class); $extend->register_endpoint_data( [ 'endpoint' => CheckoutSchema::IDENTIFIER, 'namespace' => 'automatewoo', 'schema_callback' => null, ] ); } public function processCheckoutBlockOptin(\WC_Order $order, $request) { $checkoutOptin = isset($request['extensions']['mailpoet']['optin']) ? (bool)$request['extensions']['mailpoet']['optin'] : false; // Emulate checkout opt-in triggering for AutomateWoo if ($checkoutOptin) { // Multi-dimensional array inside an ArrayAccess object // cannot be modified directly, so an intermediate variable is used $requestExtensions = $request['extensions']; $requestExtensions['automatewoo']['optin'] = 'On'; $request['extensions'] = $requestExtensions; } if (!$order->get_billing_email()) { return; } // Fetch existing woo subscriber and in case there is not any sync as guest $email = $order->get_billing_email(); $subscriber = $this->subscribersRepository->findOneBy(['email' => $email, 'isWoocommerceUser' => true]); if (!$subscriber instanceof SubscriberEntity) { $this->wooSegment->synchronizeGuestCustomer($order->get_id()); $subscriber = $this->subscribersRepository->findOneBy(['email' => $email, 'isWoocommerceUser' => true]); } // Subscriber not found and guest sync failed if (!$subscriber instanceof SubscriberEntity) { return null; } $this->woocommerceSubscription->handleSubscriberOptin($subscriber, $checkoutOptin); } }
Fatal error: Uncaught Error: Class "MailPoet\PostEditorBlocks\WooCommerceBlocksIntegration" not found in /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php:2640 Stack trace: #0 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(122): MailPoetGenerated\FreeCachedContainer->getInitializerService() #1 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(110): MailPoetVendor\Symfony\Component\DependencyInjection\Container->make('MailPoet\\Config...', 1) #2 /htdocs/wp-content/plugins/mailpoet/lib/DI/ContainerWrapper.php(39): MailPoetVendor\Symfony\Component\DependencyInjection\Container->get('MailPoet\\Config...') #3 /htdocs/wp-content/plugins/mailpoet/mailpoet_initializer.php(89): MailPoet\DI\ContainerWrapper->get('MailPoet\\Config...') #4 /htdocs/wp-content/plugins/mailpoet/mailpoet.php(194): require_once('/htdocs/wp-cont...') #5 /htdocs/wp-settings.php(526): include_once('/htdocs/wp-cont...') #6 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...') #7 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #8 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #9 /htdocs/index.php(17): require('/htdocs/wp-blog...') #10 {main} thrown in /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php on line 2640