Automattic\WooCommerce\Internal\Admin\Suggestions
PaymentExtensionSuggestionIncentives::get_incentives()
Get the incentives list for a specific payment extension suggestion.
Метод класса: PaymentExtensionSuggestionIncentives{}
Хуков нет.
Возвращает
Массив
. The incentives list.
Использование
$PaymentExtensionSuggestionIncentives = new PaymentExtensionSuggestionIncentives(); $PaymentExtensionSuggestionIncentives->get_incentives( $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. If not provided, all incentives for the suggestion will be returned.
По умолчанию: '' - $skip_visibility_check(true|false)
- Whether to skip the visibility check for the incentives.
По умолчанию: false
Код PaymentExtensionSuggestionIncentives::get_incentives() PaymentExtensionSuggestionIncentives::get incentives WC 9.6.1
public function get_incentives( string $suggestion_id, string $country_code, string $incentive_type = '', bool $skip_visibility_check = false ): array { $provider = $this->get_incentive_instance( $suggestion_id ); if ( null === $provider ) { return array(); } $incentives = $provider->get_all( $country_code, $incentive_type ); if ( ! $skip_visibility_check ) { $incentives = array_filter( $incentives, fn( $incentive ) => $provider->is_visible( $incentive['id'], $country_code ) ); } return array_values( $incentives ); }