Skip to content

Commit ee8cb31

Browse files
Update and rename move-variation-description-from-original-location-to-single-product-summary.txt to change-cod-order-status-to-on-hold.txt
1 parent 2647c28 commit ee8cb31

File tree

2 files changed

+13
-27
lines changed

2 files changed

+13
-27
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
add_filter( 'woocommerce_checkout_order_processed', 'change_cod_order_status_to_on_hold', 10, 3 );
2+
3+
function change_cod_order_status_to_on_hold( $order_id, $posted_data, $order ) {
4+
if ( ! $order instanceof WC_Order ) {
5+
return;
6+
}
7+
8+
// Check if payment method is Cash on Delivery
9+
if ( $order->get_payment_method() === 'cod' && $order->get_status() === 'processing' ) {
10+
// Set order status to 'on-hold'
11+
$order->update_status( 'on-hold', __( 'Order status changed to on-hold for COD payment method.', 'your-textdomain' ) );
12+
}
13+
}

Execute a function on a child site/WooCommerce/move-variation-description-from-original-location-to-single-product-summary.txt

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)