Automattic\WooCommerce\Internal\Admin\Suggestions
PaymentsExtensionSuggestionIncentives::get_incentive
Get the first found incentive details for a specific payment extension suggestion.
Method of the class: PaymentsExtensionSuggestionIncentives{}
No Hooks.
Returns
?Array. The incentive details. Returns null if there is no incentive available.
Usage
$PaymentsExtensionSuggestionIncentives = new PaymentsExtensionSuggestionIncentives(); $PaymentsExtensionSuggestionIncentives->get_incentive( $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.
Default: '' - $skip_visibility_check(true|false)
- Whether to skip the visibility check for the incentives.
Default: false
PaymentsExtensionSuggestionIncentives::get_incentive() PaymentsExtensionSuggestionIncentives::get incentive code WC 10.3.3
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 );
}