Merge pull request #17965 from james-allan/complete_payment_using_manual_gateways
Mark $0 orders as payment complete when processing payments with core gateways
This commit is contained in:
commit
4443d473ab
|
@ -342,8 +342,12 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
// Mark as on-hold (we're awaiting the payment)
|
||||
$order->update_status( 'on-hold', __( 'Awaiting BACS payment', 'woocommerce' ) );
|
||||
if ( $order->get_total() > 0 ) {
|
||||
// Mark as on-hold (we're awaiting the payment)
|
||||
$order->update_status( 'on-hold', __( 'Awaiting BACS payment', 'woocommerce' ) );
|
||||
} else {
|
||||
$order->payment_complete();
|
||||
}
|
||||
|
||||
// Reduce stock levels
|
||||
wc_reduce_stock_levels( $order_id );
|
||||
|
|
|
@ -113,8 +113,12 @@ class WC_Gateway_Cheque extends WC_Payment_Gateway {
|
|||
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
// Mark as on-hold (we're awaiting the cheque)
|
||||
$order->update_status( 'on-hold', _x( 'Awaiting check payment', 'Check payment method', 'woocommerce' ) );
|
||||
if ( $order->get_total() > 0 ) {
|
||||
// Mark as on-hold (we're awaiting the cheque)
|
||||
$order->update_status( 'on-hold', _x( 'Awaiting check payment', 'Check payment method', 'woocommerce' ) );
|
||||
} else {
|
||||
$order->payment_complete();
|
||||
}
|
||||
|
||||
// Reduce stock levels
|
||||
wc_reduce_stock_levels( $order_id );
|
||||
|
|
|
@ -178,8 +178,12 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
|
|||
public function process_payment( $order_id ) {
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
// 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' ) );
|
||||
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();
|
||||
}
|
||||
|
||||
// Reduce stock levels
|
||||
wc_reduce_stock_levels( $order_id );
|
||||
|
|
Loading…
Reference in New Issue