I'm trying to work on something new for displaying 2 different thank you pages for the woocommerce plugin. When a user has selected a different shipping method like local pickups I want to redirect them to different thank you pages after checkout.

I have added the following code but it doesn't works redirects to the default. What am I doing wrong

```
// Thank you page redirect
add_action( 'template_redirect', 'woo_custom_redirect_after_purchase' );
function woo_custom_redirect_after_purchase() {
    global $wp;
    if ( is_checkout() && !empty( $wp->query_vars['order-received'] ) ) {
        wp_redirect( 'https://mywebsite.com/thank-you-page-1/' );
        exit;
    }
    elseif( $order->has_shipping_method('local_pickup:7') ) {
        wp_redirect( 'https://mywebsite.com/thank-you-page-2/' );
        exit;
    }
    elseif( $order->has_shipping_method('flat_rate:1') ) {
        wp_redirect( 'https://mywebsite.com/thank-you-page-3/' );
        exit;
    }
}

```

Not sure what's happening, might be I'm missing or doing something wrong.