2

I am trying use the filter woocommerce_payment_complete_order_status. I have tried a lot of things, but I'm not able to get it to work.

function cod_to_onhold( $order_status, $order_id ) {
    //global $woocommerce;
    $order = new WC_Order($order_id);
    return 'completed';

    error_log("order marked completed", 0);

}

add_filter( 'woocommerce_payment_complete_order_status', 'cod_to_onhold', 10, 2 );
brasofilo
  • 25,496
  • 15
  • 91
  • 179
Nikhil
  • 1,268
  • 2
  • 13
  • 29
  • Yep, nothing seems to trigger that filter. But, *what's your goal?* – brasofilo Mar 02 '14 at 16:01
  • In woocommerce 2.1 COD order taken under Processing, though in earlier version the default was 'on-hold'. I want to make sure that all COD orders are 'on-hold' for new woocommerce also. – Nikhil Mar 05 '14 at 07:46
  • @brasofilo do you know a solution to this.. – Nikhil Mar 18 '14 at 10:17
  • Hi, Nikhil, nope... that day I tested and couldn't get anything too, looks like the method `payment_complete` is not being fired. [Taking another look at the file](https://plugins.trac.wordpress.org/browser/woocommerce/tags/2.1.5/includes/class-wc-order.php#L1340) I see other filters and actions that may be worth a try. – brasofilo Mar 18 '14 at 10:43
  • Possible duplicate of [update woocommerce order status after payment process complete and redirect to store](https://stackoverflow.com/questions/32988565/update-woocommerce-order-status-after-payment-process-complete-and-redirect-to-s) – Adal Feb 13 '18 at 21:55
  • I'm voting to close this question as off-topic because Because this question is outdated and should be closed (3 years old and so many things have changed)… – LoicTheAztec Feb 15 '18 at 19:21

0 Answers0