check if order id exists wordpress woccommerce

To check if an order ID exists in WordPress WooCommerce, you can use the following code:

$order = wc_get_order( $order_id );
if ( $order ) {
    // Order exists
} else {
    // Order does not exist

This code first retrieves the order using wc_get_order() function and then checks if the order exists. If it does, the "Order exists" message will be displayed; otherwise, the "Order does not exist" message will be displayed.