'Custom Theme Single Product Page Wordpress/Woocommerce

I am building my custom theme and my single.php displays woocommerce single product page with

if ( have_posts() ) {
    while( have_posts() ) {
          the_post();
          the_content();
    }
} 

enter image description here

Why is the page missing - title, reviews & breadcrumbs?



Solution 1:[1]

 function mytheme_add_woocommerce_support() {
        add_theme_support( 'woocommerce' );
    add_theme_support( 'wc-product-gallery-zoom' );
    add_theme_support( 'wc-product-gallery-lightbox' );
    add_theme_support( 'wc-product-gallery-slider' );
    }
    
    add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );

Please add this one in the functions.php file

Solution 2:[2]

Woocommerce has its own templates for their pages. A single product should be showing on single-product.php. You would create a woocommerce folder inside your custom theme and copy the directories and files you want to edit over to your theme.

How to override single-product.php

If you want to custimize the single-product.php, you would create a woocommerce folder in your theme and copy the single-product.php over into it. So the directory would be yourtheme/woocommerce/templates/single-product.php. This way you have all the actions hooking in the functionality you are missing.

Here are the docs: https://woocommerce.com/document/template-structure/

Solution 3:[3]

I was missing

add_theme_support('woocommerce');

in my functions.php file

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dotsquares
Solution 2 Nimantha
Solution 3 Adrian Pekron