Automattic\WooCommerce\Internal\OrderWithdrawal
OrderWithdrawalFormProcessor::add_order_withdrawal_inbox_note
Add a withdrawal request notification to the merchant's WooCommerce inbox.
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_inbox_note( $matched_order ): void;
- $matched_order(WC_Order) (required)
- Matched order.
OrderWithdrawalFormProcessor::add_order_withdrawal_inbox_note() OrderWithdrawalFormProcessor::add order withdrawal inbox note code WC 11.1.2
private function add_order_withdrawal_inbox_note( WC_Order $matched_order ): void {
try {
$content = sprintf(
/* translators: %s: order number. */
__( 'A customer submitted an order withdrawal request for order #%s. Review the matched order to confirm the request details.', 'woocommerce' ),
$matched_order->get_order_number()
);
if ( $this->is_order_outside_withdrawal_window( $matched_order ) ) {
$content .= ' ' . $this->get_withdrawal_window_warning_message();
}
$note = new Note();
$note->set_title(
sprintf(
/* translators: %s: order number. */
__( 'Order withdrawal request for #%s', 'woocommerce' ),
$matched_order->get_order_number()
)
);
$note->set_content( $content );
$note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::INBOX_NOTE_NAME_PREFIX . $matched_order->get_id() );
$note->set_source( 'woocommerce-admin' );
$order_url = $matched_order->get_edit_order_url();
if ( '' !== $order_url ) {
$note->add_action( 'view-order', __( 'View order', 'woocommerce' ), $order_url );
}
$note->save();
} catch ( Throwable $e ) {
$this->log_inbox_note_error( $e, $matched_order->get_id() );
}
}