I used a code to redirect the buyer to a customised page. But I would like to add a different redirect per product category as set in Woocommerce.

This is the code I'm using to redirect for all purchases. Now I need to change it to a redirect per categegory. For example if someone buys a shop product it goed to page A and when they purchase a course it goes to page B after purchase.

```
<?php

/* Redirect user after check out */
add_action( 'template_redirect', 'jay_custom_redirect_after_purchase' ); 
function jay_custom_redirect_after_purchase() {
    global $wp;

    if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) {
        wp_redirect( 'http://www.yoururl.com/your-page/' );
        exit;
    }
}

```