<?php /* Reset status of new orders from "pending" to "completed" */ add_action( 'woocommerce_thankyou', 'changeOrderStatus' ); function changeOrderStatus($order_id) { global $woocommerce; if (!$order_id ) return; $billing_paymethod = get_post_meta($order_id,'_payment_method',true); $order = new WC_Order( $order_id ); /* put here your specific payment method */ if($billing_paymethod == 'paypal') { /* put here your specific order status */ $order->update_status( 'completed' ); } else { /* put here your specfic default order status for all payment method */ $order->update_status( 'processing' ); } } ?>
Change order status in WooCommerce for specific payment method
Copy this code in your theme's function.php file
Labels:
wordpress
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment