WC_Post_Data::schedule_variation_summary_regenerationprivate staticWC 1.0

Schedule an asynchronous action to regenerate product variation summaries.

This method uses the WooCommerce Action Scheduler to queue a single regeneration action for product variation summaries. It first checks whether an identical action with the given arguments is already scheduled to avoid duplicate jobs. If the Action Scheduler is not available, a warning is logged instead.

Метод класса: WC_Post_Data{}

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = WC_Post_Data::schedule_variation_summary_regeneration( $action_name, $args, $warning_message, $group );
$action_name(строка) (обязательный)
The name/identifier of the scheduled action (hook name).
$args(массив) (обязательный)
Arguments to pass to the scheduled action callback.
$warning_message(строка) (обязательный)
Message to log when the Action Scheduler is unavailable.
$group(строка)
The Action Scheduler group to associate with the scheduled action.
По умолчанию: 'woocommerce'

Код WC_Post_Data::schedule_variation_summary_regeneration() WC 11.0.1

private static function schedule_variation_summary_regeneration( $action_name, $args, $warning_message, $group = 'woocommerce' ) {
	if ( function_exists( 'as_schedule_single_action' ) ) {
		// Prevent duplicate scheduling of the action.
		$when = as_next_scheduled_action( $action_name, $args, $group );
		if ( ! $when ) {
			as_schedule_single_action( time() + 1, $action_name, $args, $group );
		}
	} else {
		wc_get_logger()->warning(
			'Action Scheduler unavailable for product variation summary regeneration. ' . $warning_message,
			array( 'source' => 'woocommerce-variations' )
		);
	}
}