Automattic\WooCommerce\Internal\Admin\Suggestions
PaymentExtensionSuggestionIncentives::get_incentive()
Get the first found incentive details for a specific payment extension suggestion.
Method of the class: PaymentExtensionSuggestionIncentives{}
No Hooks.
Return
?Array
. The incentive details. Returns null if there is no incentive available.
Usage
$PaymentExtensionSuggestionIncentives = new PaymentExtensionSuggestionIncentives(); $PaymentExtensionSuggestionIncentives->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
PaymentExtensionSuggestionIncentives::get_incentive() PaymentExtensionSuggestionIncentives::get incentive code 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 ); }