Untitled
unknown
plain_text
2 years ago
562 B
7
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 quotes' );
break;
}
}
}Editor is loading...
Leave a Comment