Automattic\WooCommerce\Internal\Admin\Suggestions

PaymentExtensionSuggestionIncentives::dismiss_incentive()publicWC 1.0

Dismiss an incentive for a specific payment extension suggestion.

Method of the class: PaymentExtensionSuggestionIncentives{}

No Hooks.

Return

true|false. True if the incentive was not previously dismissed and now it is. False otherwise.

Usage

$PaymentExtensionSuggestionIncentives = new PaymentExtensionSuggestionIncentives();
$PaymentExtensionSuggestionIncentives->dismiss_incentive( $incentive_id, $suggestion_id, $context ): bool;
$incentive_id(string) (required)
The incentive ID.
$suggestion_id(string) (required)
The suggestion ID.
$context(string)
The context ID for which the incentive should be dismissed. If not provided, the incentive will be dismissed for all contexts.
Default: 'all'

PaymentExtensionSuggestionIncentives::dismiss_incentive() code WC 9.6.1

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 );
}