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

Automattic\WooCommerce\Admin\Notes

WC_Admin_Notes_Woo_Subscriptions_Notes::refresh_subscription_notes() public WC 1.0

For each active subscription on this site, checks the expiration date and creates/updates/deletes notes.

{} Это метод класса: 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->refresh_subscription_notes();

Код WC_Admin_Notes_Woo_Subscriptions_Notes::refresh_subscription_notes() WC 4.7.0

<?php
public function refresh_subscription_notes() {
	if ( ! $this->is_connected() ) {
		return;
	}

	$this->prune_inactive_subscription_notes();

	$subscriptions      = \WC_Helper::get_subscriptions();
	$active_product_ids = $this->get_subscription_active_product_ids();

	foreach ( (array) $subscriptions as $subscription ) {
		// Only concern ourselves with active products.
		$product_id = $subscription['product_id'];
		if ( ! in_array( $product_id, $active_product_ids, true ) ) {
			continue;
		}

		// If the subscription will auto-renew, clean up and exit.
		if ( $subscription['autorenew'] ) {
			$this->delete_any_note_for_product_id( $product_id );
			continue;
		}

		// If the subscription is not expiring by the first threshold, clean up and exit.
		$bump_thresholds = $this->get_bump_thresholds();
		$first_threshold = DAY_IN_SECONDS * $bump_thresholds[0];
		$expires         = intval( $subscription['expires'] );
		$time_now_gmt    = current_time( 'timestamp', 0 );
		if ( $expires > $time_now_gmt + $first_threshold ) {
			$this->delete_any_note_for_product_id( $product_id );
			continue;
		}

		// Otherwise, if the subscription can still have auto-renew enabled, let them know that now.
		if ( $expires > $time_now_gmt ) {
			$this->add_or_update_subscription_expiring( $subscription );
			continue;
		}

		// If we got this far, the subscription has completely expired, let them know.
		$this->add_or_update_subscription_expired( $subscription );
	}
}