WC_Product_Usage_Notice::is_product_notice_dismissed_recently()
Check whether the user dismissed given product usage notice recently.
Метод класса: WC_Product_Usage_Notice{}
Хуков нет.
Возвращает
true|false
.
Использование
$result = WC_Product_Usage_Notice::is_product_notice_dismissed_recently( $user_id, $product_id ): bool;
- $user_id(int) (обязательный)
- User ID.
- $product_id(int) (обязательный)
- Product ID.
Код WC_Product_Usage_Notice::is_product_notice_dismissed_recently() WC Product Usage Notice::is product notice dismissed recently WC 9.4.2
private static function is_product_notice_dismissed_recently( int $user_id, int $product_id ): bool { $last_dismissed_ts = absint( get_user_meta( $user_id, self::DISMISSED_TIMESTAMP_META_PREFIX . $product_id, true ) ); if ( 0 === $last_dismissed_ts ) { return false; } $seconds_since_dismissed = time() - $last_dismissed_ts; $wait_after_dismiss = self::$current_notice_rule['wait_in_seconds_after_dismiss']; return $seconds_since_dismissed < $wait_after_dismiss; }