Plugin Directory

Changeset 3823549


Ignore:
Timestamp:
11/25/2026 06:02:17 PM (less than one hour ago)
Author:
PushEngage
Message:

updated WooCommerce Check for LP Promotion

Location:
pushengage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pushengage/tags/4.3.1/app/Includes/LedgerPortPromo.php

    r3823495 r3823549  
    33namespace Pushengage\Includes;
    44
     5use Pushengage\Integrations\Helpers as IntegrationHelpers;
     6use Pushengage\Utils\Options;
    57use Pushengage\Utils\RecommendedPlugins;
    68
    … …  
    5961
    6062        /**
    61          * Whether the promo applies to this site.
    62          *
    63          * WooCommerce is not required here: LedgerPort asks for it itself after
    64          * it is installed.
     63         * Whether the promo applies to this site: it is connected to PushEngage,
     64         * runs WooCommerce, can run LedgerPort, and does not already run it.
    6565         *
    6666         * @return bool
    6767         */
    6868        public static function is_eligible() {
    69                 return self::is_supported() && ! self::is_ledgerport_active();
     69                return Options::has_credentials() && self::meets_site_requirements();
     70        }
     71
     72        /**
     73         * Everything is_eligible() asks for except the PushEngage connection.
     74         *
     75         * The dashboard payload uses this on its own: a site can connect without
     76         * a page reload, so the dashboard checks the connection from its session.
     77         *
     78         * @return bool
     79         */
     80        private static function meets_site_requirements() {
     81                return IntegrationHelpers::is_woocommerce_active()
     82                        && self::is_supported()
     83                        && ! self::is_ledgerport_active();
    7084        }
    7185
    … …  
    115129
    116130                return array(
    117                         'show'       => self::is_eligible() && empty( get_option( self::OPTION_DISMISSED ) ),
     131                        'show'       => self::meets_site_requirements() && empty( get_option( self::OPTION_DISMISSED ) ),
    118132                        'installed'  => ! empty( $addon['installed'] ),
    119133                        'canInstall' => self::can_install(),
  • pushengage/trunk/app/Includes/LedgerPortPromo.php

    r3823495 r3823549  
    33namespace Pushengage\Includes;
    44
     5use Pushengage\Integrations\Helpers as IntegrationHelpers;
     6use Pushengage\Utils\Options;
    57use Pushengage\Utils\RecommendedPlugins;
    68
    … …  
    5961
    6062        /**
    61          * Whether the promo applies to this site.
    62          *
    63          * WooCommerce is not required here: LedgerPort asks for it itself after
    64          * it is installed.
     63         * Whether the promo applies to this site: it is connected to PushEngage,
     64         * runs WooCommerce, can run LedgerPort, and does not already run it.
    6565         *
    6666         * @return bool
    6767         */
    6868        public static function is_eligible() {
    69                 return self::is_supported() && ! self::is_ledgerport_active();
     69                return Options::has_credentials() && self::meets_site_requirements();
     70        }
     71
     72        /**
     73         * Everything is_eligible() asks for except the PushEngage connection.
     74         *
     75         * The dashboard payload uses this on its own: a site can connect without
     76         * a page reload, so the dashboard checks the connection from its session.
     77         *
     78         * @return bool
     79         */
     80        private static function meets_site_requirements() {
     81                return IntegrationHelpers::is_woocommerce_active()
     82                        && self::is_supported()
     83                        && ! self::is_ledgerport_active();
    7084        }
    7185
    … …  
    115129
    116130                return array(
    117                         'show'       => self::is_eligible() && empty( get_option( self::OPTION_DISMISSED ) ),
     131                        'show'       => self::meets_site_requirements() && empty( get_option( self::OPTION_DISMISSED ) ),
    118132                        'installed'  => ! empty( $addon['installed'] ),
    119133                        'canInstall' => self::can_install(),
Note: See TracChangeset for help on using the changeset viewer.