Automattic\WooCommerce\Internal\Admin\WCPayPromotion
Init::get_cached_or_default_promotions
Gets either cached or default promotions.
Метод класса: Init{}
Хуков нет.
Возвращает
Массив.
Использование
$result = Init::get_cached_or_default_promotions();
Код Init::get_cached_or_default_promotions() Init::get cached or default promotions WC 10.4.3
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'];
}