WC_Gateway_COD::process_payment()publicWC 1.0

Process the payment and return the result.

Метод класса: WC_Gateway_COD{}

Возвращает

Массив.

Использование

$WC_Gateway_COD = new WC_Gateway_COD();
$WC_Gateway_COD->process_payment( $order_id );
$order_id(int) (обязательный)
Order ID.

Код WC_Gateway_COD::process_payment() WC 9.3.3

public function process_payment( $order_id ) {
	$order = wc_get_order( $order_id );

	if ( $order->get_total() > 0 ) {
		// Mark as processing or on-hold (payment won't be taken until delivery).
		$order->update_status( apply_filters( 'woocommerce_cod_process_payment_order_status', $order->has_downloadable_item() ? 'on-hold' : 'processing', $order ), __( 'Payment to be made upon delivery.', 'woocommerce' ) );
	} else {
		$order->payment_complete();
	}

	// Remove cart.
	WC()->cart->empty_cart();

	// Return thankyou redirect.
	return array(
		'result'   => 'success',
		'redirect' => $this->get_return_url( $order ),
	);
}