Add second single product page in Woocommerce

Is it possible to add a second single product page in Woocommerce?

So basically when I am at the single product page I click the “next” button and I get directed to the same single product page with another template. So I just want to retrieve the same data on the second page.

Read More

Single product page:
enter image description here

Next page:
enter image description here

And the next page would be the checkout page but that would just be a link to the checkout page so that part would be easy.

Related posts

1 comment

  1. What I would do in this case is add a link that will reload the page with a custom query arg in the URL.

    Then you can filter the template via template_include to load a different template. Untested, so be careful of syntax typos.

    add_filter( 'template_include', 'so_30978278_single_product_alt' );
    function so_30978278_single_product_alt( $template ){
        if ( is_single() && get_post_type() == 'product' && isset( $_GET['next-step'] ) && intval( $_GET['next-step'] ) == 1 ) {
            $template = locate_template( 'single-product-alt.php' );
        }
        return $template; 
    }
    
    add_action( 'woocommerce_before_add_to_cart_form', 'so_30978278_additional_template_button' );
    function so_30978278_additional_template_button(){
        printf( '<a class="button" href="%s">%s</a>', esc_url( add_query_arg( 'next-step', 1 ) ), __( 'Next Step' ) );
    }
    

    See add_query_arg for reference.

Comments are closed.