WC_Gateway_Cheque::process_payment()
Process the payment and return the result.
Method of the class: WC_Gateway_Cheque{}
Hooks from the method
Return
Array
.
Usage
$WC_Gateway_Cheque = new WC_Gateway_Cheque(); $WC_Gateway_Cheque->process_payment( $order_id );
- $order_id(int) (required)
- Order ID.
WC_Gateway_Cheque::process_payment() WC Gateway Cheque::process payment code WC 9.7.1
public function process_payment( $order_id ) { $order = wc_get_order( $order_id ); if ( $order->get_total() > 0 ) { /** * Filter the order status for cheque payment. * * @since 3.6.0 * * @param string $status The default status. * @param object $order The order object. */ $process_payment_status = apply_filters( 'woocommerce_cheque_process_payment_order_status', OrderStatus::ON_HOLD, $order ); // Mark as on-hold (we're awaiting the cheque). $order->update_status( $process_payment_status, _x( 'Awaiting check payment', 'Check payment method', 'woocommerce' ) ); } else { $order->payment_complete(); } // Remove cart. WC()->cart->empty_cart(); // Return thankyou redirect. return array( 'result' => 'success', 'redirect' => $this->get_return_url( $order ), ); }