Automattic\WooCommerce\Internal\Admin\WCPayPromotion
Init::get_cached_or_default_promotions
Gets either cached or default promotions.
Method of the class: Init{}
No Hooks.
Returns
Array.
Usage
$result = Init::get_cached_or_default_promotions();
Init::get_cached_or_default_promotions() Init::get cached or default promotions code WC 10.5.0
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'];
}