Automattic\WooCommerce\Internal\OrderWithdrawal
OrderWithdrawalFeatureHighlightNotification::possibly_add_enabled_note
Add a note when the order withdrawal feature is enabled.
Method of the class: OrderWithdrawalFeatureHighlightNotification{}
No Hooks.
Returns
null. Nothing (null).
Usage
$OrderWithdrawalFeatureHighlightNotification = new OrderWithdrawalFeatureHighlightNotification(); $OrderWithdrawalFeatureHighlightNotification->possibly_add_enabled_note( $feature_id, $enabled ): void;
- $feature_id(mixed) (required)
- Feature being toggled.
- $enabled(mixed) (required)
- Whether the feature was enabled.
Changelog
| Since 11.3.0 | Introduced. |
OrderWithdrawalFeatureHighlightNotification::possibly_add_enabled_note() OrderWithdrawalFeatureHighlightNotification::possibly add enabled note code WC 11.3.0
public function possibly_add_enabled_note( $feature_id, $enabled ): void {
if ( 'order_withdrawal' !== $feature_id || true !== $enabled ) {
return;
}
try {
if ( $this->note_exists( self::ENABLED_NOTE_NAME ) ) {
$this->dismiss_note( self::NOTE_NAME );
return;
}
$this->get_enabled_note()->save();
$this->dismiss_note( self::NOTE_NAME );
} catch ( Exception $exception ) {
wc_get_logger()->error(
'Unable to create the order withdrawal enabled inbox notification.',
array(
'source' => 'order-withdrawal',
'exception' => $exception,
)
);
}
}