WC_Gateway_Cheque::process_payment( int $order_id )
Process the payment and return the result.
Description Description
Parameters Parameters
- $order_id
-
(Required) Order ID.
Return Return
(array)
Source Source
File: includes/gateways/cheque/class-wc-gateway-cheque.php
public function process_payment( $order_id ) {
$order = wc_get_order( $order_id );
if ( $order->get_total() > 0 ) {
// Mark as on-hold (we're awaiting the cheque).
$order->update_status( apply_filters( 'woocommerce_cheque_process_payment_order_status', 'on-hold', $order ), _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 ),
);
}