Automattic\WooCommerce\Internal\Admin\Suggestions

PaymentsExtensionSuggestionIncentives::get_incentivepublicWC 1.0

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

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

Хуков нет.

Возвращает

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

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

$PaymentsExtensionSuggestionIncentives = new PaymentsExtensionSuggestionIncentives();
$PaymentsExtensionSuggestionIncentives->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

Код PaymentsExtensionSuggestionIncentives::get_incentive() WC 11.0.1

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 );
}