0
votes

I am selling a single product with WooCommerce so I don't have the shop base page. Right now I have added the product post to my main menu, but I would like to actually use the product shortcode to display a full single product [product_page_ID="99"] on a normal page so that I can easily add other content to it too, and add this page to my menu instead. But then I would still end up with the single product post with basically the same content(accessible under .../shop/product), how can I avoid this?

1

1 Answers

1
votes

Create a new page and add the following shortcode to it [product_page id="123"] ( replace 123 with a valid product ID ) add extra content as required, and then add the page to your menu.

But then I would still end up with the single product post with basically the same content(accessible under .../shop/product), how can I avoid this?

On your other thread I provided you with some code about redirecting the shop base, you need to modify it to also include the single product page, here's the updated version :

add_action( 'template_redirect', 'redirect_shop' );

function redirect_Shop() {

    // added is_product() conditional to stop users from accessing the single product page
    if( is_shop() || is_product() ) {

        //replace the link below to point to your custom product page
        header('HTTP/1.1 301 Moved Permanently');
        header('location:http://www.example.com/page');
        exit;

    }
}