Automattic\WooCommerce\Internal\Admin\Suggestions
PaymentExtensionSuggestionIncentives::get_incentives()
Get the incentives list for a specific payment extension suggestion.
Method of the class: PaymentExtensionSuggestionIncentives{}
No Hooks.
Return
Array
. The incentives list.
Usage
$PaymentExtensionSuggestionIncentives = new PaymentExtensionSuggestionIncentives(); $PaymentExtensionSuggestionIncentives->get_incentives( $suggestion_id, $country_code, $incentive_type, $skip_visibility_check ): array;
- $suggestion_id(string) (required)
- The suggestion ID.
- $country_code(string) (required)
- The business location country code to get incentives for.
- $incentive_type(string)
- The type of incentive to check for. If not provided, all incentives for the suggestion will be returned.
Default: '' - $skip_visibility_check(true|false)
- Whether to skip the visibility check for the incentives.
Default: false
PaymentExtensionSuggestionIncentives::get_incentives() PaymentExtensionSuggestionIncentives::get incentives code 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 ); }