0

I would like to immidialtey change the order status from specific orders (payment method = stripe_sofort) to a custom status, that I already have in use:

add_action( 'woocommerce_thankyou', 'woocommerce_auto_processing_orders');
function woocommerce_auto_processing_orders( $order_id ) {
    if ( ! $order_id )
        return;

    $order = wc_get_order( $order_id );

    // If order is "on-hold" update status to "processing-melle"
    if( $order->get_payment_method() == 'stripe_sofort' && $order->has_status( 'on-hold' ) ) {
        $order->update_status( 'my_status' );
    }
}

this code does not work, but I actually don't understand why. do you guys have an idea?

thanks!

Ele
  • 523
  • 2
  • 6
  • 19
  • Check this - https://www.businessbloomer.com/woocommerce-payment-gateway-order-status/ – Snuffy Aug 11 '22 at 07:41
  • Does this answer your question? [WooCommerce: Order status based on Payment methods](https://stackoverflow.com/questions/66658628/woocommerce-order-status-based-on-payment-methods) – Cornel Raiu Aug 11 '22 at 07:41
  • thanks for you answer, somehow they seem to use the hook woocommerce_xxx_process_payment_order_status ... I cannot figure out how the hook is called for Stripes Sofort payment method. :( – Ele Aug 11 '22 at 10:41

0 Answers0