diff --git a/composer.lock b/composer.lock index 47734d5a..dd379584 100644 --- a/composer.lock +++ b/composer.lock @@ -6178,5 +6178,5 @@ "platform-overrides": { "php": "7.3.0" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/includes/ECommerce.php b/includes/ECommerce.php index f1a3dd62..cfb26062 100644 --- a/includes/ECommerce.php +++ b/includes/ECommerce.php @@ -107,8 +107,7 @@ public function __construct( Container $container ) { add_action( 'wp_login', array( $this, 'show_store_setup' ) ); add_action( 'auth_cookie_expired', array( $this, 'show_store_setup' ) ); - $brandNameValue = $container->plugin()->brand; - $this->set_wpnav_collapse_setting( $brandNameValue ); + add_action('admin_enqueue_scripts', array( $this, 'set_wpnav_collapse_setting')); if ( ( $container->plugin()->id === 'bluehost' && ( $canAccessGlobalCTB || $hasYithExtended ) ) || ( $container->plugin()->id === 'hostgator' && $hasYithExtended ) ) { add_filter( 'admin_menu', array( $this, 'custom_add_promotion_menu_item' ) ); @@ -198,12 +197,11 @@ public static function add_filters( $tags, $function_to_add, $priority = 10, $ac } /** - * Set the wpnav_collapse setting - * - * @param string $brandNameValue The brand name value + * Set the wpnav_collapse setting */ - public static function set_wpnav_collapse_setting( $brandNameValue ) { + public function set_wpnav_collapse_setting() { + $brandNameValue = $this->container->plugin()->brand; wp_enqueue_script( 'nfd_wpnavbar_setting', NFD_ECOMMERCE_PLUGIN_URL . 'vendor/newfold-labs/wp-module-ecommerce/includes/wpnavbar.js', array( 'jquery' ), '1.0', true ); $params = array( 'nfdbrandname' => $brandNameValue ); wp_localize_script( 'nfd_wpnavbar_setting', 'navBarParams', $params ); @@ -392,7 +390,6 @@ public function register_assets() { NFD_ECOMMERCE_DIR . '/languages' ); \wp_enqueue_script( 'nfd-ecommerce-dependency' ); - \wp_enqueue_script( 'nfd_wpnavbar_setting' ); } }