Change order status to complete for WooCommerce Bookings

Looking to automatically change the order status to complete once a booking has been marked as complete in the WooCommece Bookings plugin?

Automatically change the order status from a newly completed booking status

To mark the order status as complete, based on if the booking status has been set to complete, you need to add the following code below to your theme’s functions.php file.

function custom_booking_complete_handler( $booking_id ) {
     $booking = new WC_Booking( $booking_id );
     $order_id = $booking->order_id;
     $order = new WC_Order( $order_id );
     $order->update_status( 'completed', 'order_note' );
add_action( 'woocommerce_booking_complete', 'custom_booking_complete_handler' );