Automattic\WooCommerce\Internal\Admin\Suggestions

PaymentExtensionSuggestionIncentives::get_incentive()publicWC 1.0

Get the first found incentive details for a specific payment extension suggestion.

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

Хуков нет.

Возвращает

?Массив. The incentive details. Returns null if there is no incentive available.

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

$PaymentExtensionSuggestionIncentives = new PaymentExtensionSuggestionIncentives();
$PaymentExtensionSuggestionIncentives->get_incentive( $suggestion_id, $country_code, $incentive_type, $skip_visibility_check ): ?array;
$suggestion_id(строка) (обязательный)
The suggestion ID.
$country_code(строка) (обязательный)
The business location country code to get incentives for.
$incentive_type(строка)
The type of incentive to check for.
По умолчанию: ''
$skip_visibility_check(true|false)
Whether to skip the visibility check for the incentives.
По умолчанию: false

Код PaymentExtensionSuggestionIncentives::get_incentive() WC 9.6.0

public function get_incentive( string $suggestion_id, string $country_code, string $incentive_type = '', bool $skip_visibility_check = false ): ?array {
	$incentives = $this->get_incentives( $suggestion_id, $country_code, $incentive_type, $skip_visibility_check );
	if ( empty( $incentives ) ) {
		return null;
	}

	return reset( $incentives );
}