Automattic\WooCommerce\Internal\OrderWithdrawal

OrderWithdrawalFeatureHighlightNotification::possibly_add_note │ public │ WC 1.0

Add the note if the store is eligible and it has never been created before.

Method of the class: OrderWithdrawalFeatureHighlightNotification{}

No Hooks.

Returns

null. Nothing (null).

Usage

$OrderWithdrawalFeatureHighlightNotification = new OrderWithdrawalFeatureHighlightNotification();
$OrderWithdrawalFeatureHighlightNotification->possibly_add_note(): void;

OrderWithdrawalFeatureHighlightNotification::possibly_add_note() code WC 11.1.2

public function possibly_add_note(): void {
	try {
		if ( $this->has_note_been_created() ) {
			return;
		}

		if ( ! $this->is_applicable() ) {
			return;
		}

		if ( ! add_option( self::CREATED_OPTION, 'yes', '', false ) ) {
			return;
		}

		$this->get_note()->save();
	} catch ( Exception $exception ) {
		delete_option( self::CREATED_OPTION );
		wc_get_logger()->error(
			'Unable to create the order withdrawal inbox notification.',
			array(
				'source'    => 'order-withdrawal',
				'exception' => $exception,
			)
		);
	}
}