Automattic\WooCommerce\Internal\OrderWithdrawal

OrderWithdrawalFormProcessor::add_order_withdrawal_note │ private │ WC 1.0

Add the withdrawal request note to a matched order.

Method of the class: OrderWithdrawalFormProcessor{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->add_order_withdrawal_note( $order, $data ): void;
$order(WC_Order) (required)
Matched order.
$data(array<string,string>) (required)
Form data.

OrderWithdrawalFormProcessor::add_order_withdrawal_note() code WC 11.1.2

private function add_order_withdrawal_note( WC_Order $order, array $data ): void {
	$note = sprintf(
		/* translators: %s: withdrawal type label. */
		__( 'Order withdrawal requested. Withdrawal type: %s.', 'woocommerce' ),
		$this->get_withdrawal_type_label( $data[ self::FIELD_WITHDRAWAL_TYPE ] )
	);

	try {
		if ( ! $order->add_order_note( $note, 0, false, array( 'note_group' => OrderNoteGroup::ORDER_UPDATE ) ) ) {
			$this->log_order_note_error( $order );
		}
	} catch ( Throwable $e ) {
		$this->log_order_note_error( $order, $e );
	}
}