Reputation: 167
On Woocommerce we have the option for BACS payments. Some orders are coming through as "Paid" and some aren't. I can't understand why as they are using the exact same payment method. The two images below will show you this:
We are using a function to automatically change these payments from "On Hold" to "Processing", in case this may have something to do with the issue. The code is below:
add_action( 'woocommerce_thankyou', 'bacs_order_payment_processing_order_status', 10, 1 );
function bacs_order_payment_processing_order_status( $order_id ) {
if ( ! $order_id ) {
return;
}
// Get an instance of the WC_Order object
$order = new WC_Order( $order_id );
if ( ( get_post_meta($order->id, '_payment_method', true) == 'bacs' || 'cod' ) && ('on-hold' == $order->status || 'pending' == $order->status) ) {
$order->update_status('processing');
}
else {
return;
}
}
// change COD payment method order status from processing to on-hold
add_action('woocommerce_thankyou_cod', 'action_woocommerce_thankyou_cod', 10, 1);
function action_woocommerce_thankyou_cod($order_id)
{
$order = wc_get_order($order_id);
$order->update_status('processing');
}
Any help would be massively appreciated!
Upvotes: 2
Views: 3650
Reputation: 253773
Your code is very outdated, confused with mistakes…
Instead, to change order status for payments like:
cod
use (default status is "processing"):cheque
use *(default status is "on-hold"):bacs
use *(default status is "on-hold"):Upvotes: 2