diff --git a/includes/Admin/Notices/Helper.php b/includes/Admin/Notices/Helper.php index 39f763d414..3a72176d1c 100644 --- a/includes/Admin/Notices/Helper.php +++ b/includes/Admin/Notices/Helper.php @@ -67,6 +67,10 @@ public static function dokan_get_promo_notices() { continue; } + if ( wc_string_to_bool( $promo['pro_only'] ) && self::is_pro_license_active() ) { + continue; + } + if ( $est_time_now >= $promo['start_date'] && $est_time_now <= $promo['end_date'] ) { $notices[] = [ 'type' => 'promotion', @@ -100,6 +104,32 @@ public static function dokan_get_promo_notices() { return array_values( $notices ); } + /** + * Check if dokan pro-license is active + * + * @since DOKAN_SINCE + * + * @return bool + */ + public static function is_pro_license_active(): bool { + if ( ! dokan()->is_pro_exists() ) { + return false; + } + + if ( ! property_exists( dokan_pro(), 'license' ) ) { + // this is old version of dokan pro + return false; + } + + $license = dokan_pro()->license->plugin_update_message(); + if ( ! empty( $license ) ) { + // if the plugin update message is not empty, then the license is not active + return false; + } + + return true; + } + /** * Check has new version in dokan lite and pro *