Automattic\WooCommerce\Internal\Admin\WCPayPromotion

Init::get_cached_or_default_promotions()public staticWC 1.0

Gets either cached or default promotions.

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

Хуков нет.

Возвращает

Массив.

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

$result = Init::get_cached_or_default_promotions();

Код Init::get_cached_or_default_promotions() WC 9.5.1

public static function get_cached_or_default_promotions() {
	$specs = 'no' === get_option( 'woocommerce_show_marketplace_suggestions', 'yes' )
		? DefaultPromotions::get_all()
		: WCPayPromotionDataSourcePoller::get_instance()->get_cached_specs();

	if ( ! is_array( $specs ) || 0 === count( $specs ) ) {
		$specs = DefaultPromotions::get_all();
	}
	$results = EvaluateSuggestion::evaluate_specs( $specs, array( 'source' => 'wc-wcpay-promotions' ) );
	return $results['suggestions'];
}