WC_Admin_Marketplace_Promotions::get_active_promotions()public staticWC 9.0

Get active Marketplace promotions from the transient. Use woocommerce_marketplace_suppress_promotions to suppress promotions.

Method of the class: WC_Admin_Marketplace_Promotions{}

Return

null. Nothing (null).

Usage

$result = WC_Admin_Marketplace_Promotions::get_active_promotions();

Changelog

Since 9.0 Introduced.

WC_Admin_Marketplace_Promotions::get_active_promotions() code WC 9.0.1

public static function get_active_promotions() {
	/**
	 * Filter to suppress the requests for and showing of marketplace promotions.
	 *
	 * @since 8.8
	 */
	if ( apply_filters( 'woocommerce_marketplace_suppress_promotions', false ) ) {
		return array();
	}

	$promotions = get_transient( self::TRANSIENT_NAME );
	if ( ! $promotions ) {
		return array();
	}

	return self::filter_out_inactive_promotions( $promotions );
}