Automattic\WooCommerce\Internal\Admin\WCPayPromotion
Init::get_wc_pay_promotion_spec
Get WooPayments promotion spec.
Метод класса: Init{}
Хуков нет.
Возвращает
Объект|false
. WooPayments promotion spec or false if there isn't one.
Использование
$result = Init::get_wc_pay_promotion_spec( $fetch_from_remote );
- $fetch_from_remote(true|false)
- Whether to fetch the spec from remote or not.
По умолчанию: true
Код Init::get_wc_pay_promotion_spec() Init::get wc pay promotion spec WC 9.9.3
public static function get_wc_pay_promotion_spec( $fetch_from_remote = true ) { $promotions = $fetch_from_remote ? self::get_promotions() : self::get_cached_or_default_promotions(); $wc_pay_promotion_spec = array_values( array_filter( $promotions, function ( $promotion ) { return isset( $promotion->plugins ) && in_array( 'woocommerce-payments', $promotion->plugins, true ); } ) ); return current( $wc_pay_promotion_spec ); }