WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

Automattic\WooCommerce\Admin\Notes

WC_Admin_Notes_WooCommerce_Payments::possibly_add_note() public WC 1.0

Maybe add a note on WooCommerce Payments for US based sites older than a week without the plugin installed.

{} Это метод класса: WC_Admin_Notes_WooCommerce_Payments{}

Хуков нет.

Возвращает

Null. Ничего.

Использование

$result = WC_Admin_Notes_WooCommerce_Payments::possibly_add_note();

Код WC_Admin_Notes_WooCommerce_Payments::possibly_add_note() WC 4.7.1

<?php
public static function possibly_add_note() {
	if ( ! self::wc_admin_active_for( WEEK_IN_SECONDS ) || 'US' !== WC()->countries->get_base_country() ) {
		return;
	}

	$data_store = \WC_Data_Store::load( 'admin-note' );

	// We already have this note? Then mark the note as actioned.
	$note_ids = $data_store->get_notes_with_name( self::NOTE_NAME );
	if ( ! empty( $note_ids ) ) {

		$note_id = array_pop( $note_ids );
		$note    = WC_Admin_Notes::get_note( $note_id );
		if ( false === $note ) {
			return;
		}

		// If the WooCommerce Payments plugin was installed after the note was created, make sure it's marked as actioned.
		if ( self::is_installed() && WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED !== $note->get_status() ) {
			$note->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED );
			$note->save();
		}

		return;
	}

	$current_date = new \DateTime();
	$publish_date = new \DateTime( '2020-04-14' );

	if ( $current_date >= $publish_date ) {

		$note = self::get_note();
		if ( self::can_be_added() ) {
			$note->save();
		}

		return;

	} else {

		$hook_name = sprintf( '%s_add_note', self::NOTE_NAME );

		if ( ! WC()->queue()->get_next( $hook_name ) ) {
			WC()->queue()->schedule_single( $publish_date->getTimestamp(), $hook_name );
		}
	}
}