Untitled

 avatar
unknown
plain_text
a year ago
636 B
5
Indexable
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 );

    // Check for the 'free shipping' method in the order
    foreach( $order->get_shipping_methods() as $shipping_method ) {
        if ( $shipping_method->get_method_id() == 'free_shipping' ) {

            $order->update_status( 'wc-pending-shipping', 'Order is pending shipping quote' );

            do_action('b2bking_after_pending_quote_order_sent', $order);

            break; 
        }
    }
}
Editor is loading...
Leave a Comment