skip to Main Content

I am building a WordPress website, where when on shop page when user click on the product it goes to the product packages template instead of single product template. and form the packages page which click on a button then the single product page should open.

I have been working on for few days, like test everything, changing the URL in shop, changing it in shop PHP files. nothing happening.

use this in function.php as well

function redirect_all_product_pages() {
    if (is_product()) {
        wp_redirect(get_permalink(get_option('woocommerce_shop_page_id')) . 'product-package/');
        exit;
    }
}
add_action('template_redirect', 'redirect_all_product_pages');
Back To Top
Search