Automattic\WooCommerce\Internal\OrderWithdrawal
OrderWithdrawalFormProcessor::submit_order_withdrawal
Submit a validated order withdrawal request.
Method of the class: OrderWithdrawalFormProcessor{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->submit_order_withdrawal( $data ): bool;
- $data(array<string,string>) (required)
- Form data.
OrderWithdrawalFormProcessor::submit_order_withdrawal() OrderWithdrawalFormProcessor::submit order withdrawal code WC 11.1.2
private function submit_order_withdrawal( array $data ): bool {
$rate_limit_ids = $this->get_rate_limit_ids( $data );
if ( ! $this->check_rate_limits( $rate_limit_ids ) ) {
return false;
}
if ( ! $this->apply_rate_limits( $rate_limit_ids ) ) {
wc_add_notice( __( 'We could not submit your withdrawal request. Please try again or contact us if the problem continues.', 'woocommerce' ), 'error' );
return false;
}
$matched_order = $this->get_matching_order( $data );
if ( $matched_order && $this->has_order_withdrawal_request( $matched_order ) ) {
wc_add_notice(
__( 'A withdrawal request has already been submitted for this order. Please contact us if you need help or want to make changes.', 'woocommerce' ),
'error'
);
$this->apply_rate_limits( $rate_limit_ids, -1 );
return false;
}
if ( ! $this->send_order_withdrawal_emails( $data, $matched_order ) ) {
wc_add_notice( __( 'We could not submit your withdrawal request. Please try again or contact us if the problem continues.', 'woocommerce' ), 'error' );
$this->apply_rate_limits( $rate_limit_ids, -1 );
return false;
}
if ( $matched_order ) {
$this->mark_order_withdrawal_requested( $matched_order );
$this->add_order_withdrawal_note( $matched_order, $data );
$this->add_order_withdrawal_inbox_note( $matched_order );
}
return true;
}