Untitled

mail@pastecode.io avatar
unknown
plain_text
20 days ago
636 B
1
Indexable
Never
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; 
        }
    }
}
Leave a Comment