/*
Theme Name: Rebellion Child
Theme URI: https://rebellion.qodeinteractive.com/
Description: A child theme of Rebellion Theme
Author: Edge Themes
Author URI: http://themeforest.net/user/edge-themes
Version: 1.1.1
Template: rebellion
*/

dd_action('woocommerce_thankyou', 'headtones_custom_thankyou_redirect');
function headtones_custom_thankyou_redirect($order_id) {
    if (! $order_id) return;

    $order = wc_get_order($order_id);
    if ($order && ! is_admin()) {
        // Prevent infinite loop
        if (! isset($_GET['redirected'])) {
            $redirect_url = home_url('/thank-you') . '?redirected=1';
            wp_redirect($redirect_url);
            exit;
        }
    }
}