mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
https://stackoverflow.com/questions/69982124/woocommerce-disable-autocomplete-%e2%82%ac-0-orders
8 lines
318 B
Text
8 lines
318 B
Text
function change_free_order_status( $order_id ) {
|
|
if ( ! $order_id ) {return;}
|
|
$order = wc_get_order( $order_id );
|
|
if($order->get_total() <= 0):
|
|
$order->update_status( 'on-hold' ); // Change to what you need
|
|
endif;
|
|
}
|
|
add_action('woocommerce_thankyou','change_free_order_status');
|