Automattic\WooCommerce\Internal\Admin\Suggestions
PaymentsExtensionSuggestionIncentives::dismiss_incentive
Dismiss an incentive for a specific payment extension suggestion.
Метод класса: PaymentsExtensionSuggestionIncentives{}
Хуков нет.
Возвращает
bool. True if the incentive was not previously dismissed and now it is. False otherwise.
Использование
$PaymentsExtensionSuggestionIncentives = new PaymentsExtensionSuggestionIncentives(); $PaymentsExtensionSuggestionIncentives->dismiss_incentive( $incentive_id, $suggestion_id, $context ): bool;
- $incentive_id(строка) (обязательный)
- The incentive ID.
- $suggestion_id(строка) (обязательный)
- The suggestion ID.
- $context(строка)
- The context ID for which the incentive should be dismissed. If not provided, the incentive will be dismissed for all contexts.
По умолчанию:'all'
Код PaymentsExtensionSuggestionIncentives::dismiss_incentive() PaymentsExtensionSuggestionIncentives::dismiss incentive WC 11.3.0
public function dismiss_incentive( string $incentive_id, string $suggestion_id, string $context = 'all' ): bool {
$provider = $this->get_incentive_instance( $suggestion_id );
if ( null === $provider ) {
throw new \Exception( 'No incentives provider for the suggestion.' );
}
return $provider->dismiss( $incentive_id, $context );
}