admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('wt_dismiss_product_ie_cta_banner_nonce'), 'action' => 'wt_dismiss_product_ie_cta_banner' )); } /** * Add the meta box to the product edit screen */ public function add_meta_box() { global $wpdb; // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching $total_products = $wpdb->get_var(" SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_type = 'product' AND post_status NOT IN ('trash') "); // Show banner if there are 50 or more products if ( !defined( 'WT_PRODUCT_IMPORT_EXPORT_DISPLAY_BANNER' ) && $total_products >= 50) { add_meta_box( 'wbte_product_import_export_pro', self::$is_bfcm_season ? ' ' : __( 'Product Import Export for WooCommerce', 'users-customers-import-export-for-wp-woocommerce' ), array($this, 'render_banner'), 'product', 'side', 'low' ); define( 'WT_PRODUCT_IMPORT_EXPORT_DISPLAY_BANNER', true ); } } /** * Render the banner HTML. */ public function render_banner() { // Check if banner should be hidden based on option $hide_banner = get_option('wt_hide_product_ie_cta_banner', false); $plugin_url = 'https://www.webtoffee.com/product/product-import-export-woocommerce/?utm_source=free_plugin_cross_promotion&utm_medium=add_new_product_tab&utm_campaign=Product_import_export'; $wt_admin_img_path = plugin_dir_url( __FILE__ ) . 'assets/images'; if ( $hide_banner ) { echo ''; return; } ?>