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

Automattic\WooCommerce\Admin\Notes

WC_Admin_Notes_Woo_Subscriptions_Notes::add_or_update_subscription_expired() public WC 1.0

Adds a note for an expired subscription, or updates an expiring note to expired.

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

Хуков нет.

Возвращает

Null. Ничего.

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

$WC_Admin_Notes_Woo_Subscriptions_Notes = new WC_Admin_Notes_Woo_Subscriptions_Notes();
$WC_Admin_Notes_Woo_Subscriptions_Notes->add_or_update_subscription_expired( $subscription );
$subscription(массив) (обязательный)
The subscription to work with.

Код WC_Admin_Notes_Woo_Subscriptions_Notes::add_or_update_subscription_expired() WC 4.7.1

<?php
public function add_or_update_subscription_expired( $subscription ) {
	$product_id   = $subscription['product_id'];
	$product_name = $subscription['product_name'];
	$product_page = $subscription['product_url'];
	$expires      = intval( $subscription['expires'] );
	$expires_date = gmdate( 'F jS', $expires );

	$note = $this->find_note_for_product_id( $product_id );
	if ( $note ) {
		$note_content_data = $note->get_content_data();
		if ( $note_content_data->expired ) {
			// We've already got a full fledged expired note for this. Bail.
			// Expired notes' content don't change with time.
			return;
		}
	}

	$note_title = sprintf(
		/* translators: name of the extension subscription that expired */
		__( '%s subscription expired', 'woocommerce' ),
		$product_name
	);

	$note_content = sprintf(
		/* translators: date the subscription expired, e.g. Jun 7th 2018 */
		__( 'Your subscription expired on %s. Get a new subscription to continue receiving updates and access to support.', 'woocommerce' ),
		$expires_date
	);

	$note_content_data = (object) array(
		'product_id'   => $product_id,
		'product_name' => $product_name,
		'expired'      => true,
		'expires'      => $expires,
		'expires_date' => $expires_date,
	);

	if ( ! $note ) {
		$note = new WC_Admin_Note();
	}

	$note->set_title( $note_title );
	$note->set_content( $note_content );
	$note->set_content_data( $note_content_data );
	$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_WARNING );
	$note->set_name( self::SUBSCRIPTION_NOTE_NAME );
	$note->set_source( 'woocommerce-admin' );
	$note->clear_actions();
	$note->add_action(
		'renew-subscription',
		__( 'Renew Subscription', 'woocommerce' ),
		$product_page
	);
	$note->save();
}