Automattic\WooCommerce\Internal\Admin\WCPayPromotion

Init::get_promotions()public staticWC 1.0

Go through the specs and run them.

Method of the class: Init{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = Init::get_promotions();

Init::get_promotions() code WC 8.7.0

public static function get_promotions() {
	$locale = get_user_locale();

	$specs   = self::get_specs();
	$results = EvaluateSuggestion::evaluate_specs( $specs );

	if ( count( $results['errors'] ) > 0 ) {
		// Unlike payment gateway suggestions, we don't have a non-empty default set of promotions to fall back to.
		// So just set the specs transient with expired time to 3 hours.
		WCPayPromotionDataSourcePoller::get_instance()->set_specs_transient( array( $locale => $specs ), 3 * HOUR_IN_SECONDS );
		self::log_errors( $results['errors'] );
	}

	return $results['suggestions'];
}