cms = 'WordPress'; $this->installed = acym_isExtensionActive('woocommerce/woocommerce.php'); $this->rootCategoryId = 0; $this->pluginDescription->name = 'WooCommerce'; $this->pluginDescription->icon = ACYM_PLUGINS_URL.'/'.basename(__DIR__).'/icon.png'; $this->pluginDescription->category = 'Content management'; $this->pluginDescription->description = '- Insert products and generate coupons in your emails
- Filter users based on their purchases'; if ($this->installed) { $this->displayOptions = [ 'title' => ['ACYM_TITLE', true], 'price' => ['ACYM_PRICE', true], 'shortdesc' => ['ACYM_SHORT_DESCRIPTION', true], 'desc' => ['ACYM_DESCRIPTION', false], 'cats' => ['ACYM_CATEGORIES', false], 'attribs' => ['ACYM_DETAILS', false], ]; $this->initCustomView(); $this->settings = [ 'custom_view' => [ 'type' => 'custom_view', 'tags' => array_merge($this->displayOptions, $this->replaceOptions, $this->elementOptions), ], 'track' => [ 'type' => 'switch', 'label' => 'ACYM_TRACKING', 'value' => 0, 'info' => 'ACYM_TRACKING_WOOCOMMERCE_DESC', ], 'cookie_expire' => [ 'type' => 'number', 'label' => 'ACYM_COOKIE_EXPIRATION', 'value' => 1, 'info' => 'ACYM_COOKIE_EXPIRATION_DESC', 'post_text' => acym_translation('ACYM_HOURS'), ], 'remove_VAT' => [ 'type' => 'switch', 'label' => 'ACYM_REMOVE_VAT', 'value' => 0, 'info' => 'ACYM_REMOVE_VAT_DESC', ], ]; $this->wcsInstalled = acym_isExtensionActive('woocommerce-subscriptions/woocommerce-subscriptions.php'); if ($this->wcsInstalled) { $this->orderTypes = [ // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch '' => __('All orders types', 'woocommerce-subscriptions'), // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch 'original' => __('Original', 'woocommerce-subscriptions'), // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch 'parent' => __('Subscription Parent', 'woocommerce-subscriptions'), // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch 'renewal' => __('Subscription Renewal', 'woocommerce-subscriptions'), // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch 'resubscribe' => __('Subscription Resubscribe', 'woocommerce-subscriptions'), // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch 'switch' => __('Subscription Switch', 'woocommerce-subscriptions'), // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch 'regular' => __('Non-subscription', 'woocommerce-subscriptions'), ]; } } else { $this->settings = [ 'not_installed' => '1', ]; } } public function getPossibleIntegrations(): ?object { return $this->pluginDescription; } public function onAcymInitWordpressAddons() { add_filter('woocommerce_checkout_fields', [$this, 'addSubscriptionFieldWC']); add_action('woocommerce_checkout_order_processed', [$this, 'subscribeUserOnCheckoutWC'], 15, 3); add_action('woocommerce_store_api_checkout_update_order_from_request', [$this, 'subscribeUserOnCheckoutWCApi'], 10, 2); if (acym_isTrackingSalesActive()) { add_action('woocommerce_payment_successful_result', [$this, 'trackingWoocommerce'], 10, 2); $this->trackingWoocommerceAddCookie(); } add_action('woocommerce_order_status_changed', [$this, 'onWooCommerceOrderStatusChange'], 50, 4); add_filter('woocommerce_mail_callback_params', [$this, 'onWooCommerceEmailSend'], 10, 2); } private function isHposActive(): bool { if ( class_exists('\Automattic\WooCommerce\Utilities\OrderUtil') && method_exists(OrderUtil::class, 'custom_orders_table_usage_is_enabled') && OrderUtil::custom_orders_table_usage_is_enabled() ) { return true; } else { return false; } } }