Code provided in documentation to complete orders not working?
-
Hi all,
In the documentation, this code was provided:
https://docs.woocommerce.com/document/automatically-complete-orders/
/** * Auto Complete all WooCommerce orders. */ add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' ); function custom_woocommerce_auto_complete_order( $order_id ) { if ( ! $order_id ) { return; } $order = wc_get_order( $order_id ); $order->update_status( 'completed' ); }
I have tried it but it does not appear to work (ie. Orders where users select Cash on Delivery go to Processing and orders where users select Direct Bank Transfer go to On Hold still. Placed it in my functions.php file of my child theme.
Can someone help me out, please?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Code provided in documentation to complete orders not working?’ is closed to new replies.