WC_Admin_Marketplace_Promotions::maybe_update_promotions()private staticWC 1.0

Fetch promotions from the API and store them in a transient. Fetching can be suppressed by the woocommerce_marketplace_suppress_promotions

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = WC_Admin_Marketplace_Promotions::maybe_update_promotions();

Код WC_Admin_Marketplace_Promotions::maybe_update_promotions() WC 9.4.2

private static function maybe_update_promotions() {
	// Fetch promotions if they're not in the transient.
	if ( false !== get_transient( self::TRANSIENT_NAME ) ) {
		return;
	}

	// Fetch promotions from the API.
	$promotions = self::fetch_marketplace_promotions();
	set_transient( self::TRANSIENT_NAME, $promotions, self::TRANSIENT_LIFE_SPAN );
}