Automattic\WooCommerce\Internal\OrderWithdrawal
OrderWithdrawalFormProcessor::submit_order_withdrawal
Submit a validated order withdrawal request.
Метод класса: OrderWithdrawalFormProcessor{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->submit_order_withdrawal( $data ): bool;
- $data(array<string,string>) (обязательный)
- Form data.
Код OrderWithdrawalFormProcessor::submit_order_withdrawal() OrderWithdrawalFormProcessor::submit order withdrawal WC 11.2.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;
}