Reputation:
I have developed a very basic WordPress theme and installed WooCommerce. Every functionality of WooCommerce is perfectly working in my theme.
Issue: Only in product detailed page, product reviews tab, reviews listing and review form are missing.
Under WooCommerce settings reviews settings is enabled and in WordPress default discussion settings is also enabled.
For product detailed page I use 'single-product.php' template with following code.
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><?php the_title();?></h2>
<?php the_content();?>
<?php endwhile; endif; ?>
Note: When I add the following in my functions.php then entire store and WooCommerce stop working and everything gets distorted.
add_theme_support( 'woocommerce' );
Please suggest how to resolve this issue.
Upvotes: 1
Views: 9526
Reputation: 111
To add to the other answers, it's worth mentioning that if you create a product while Wordpress comments are disabled, even if you then enable them and manually add a review from the backend, it still won't show in the frontend, and the reviews tab for that product will still be disabled. This had me stumped until I tried creating a new product and the review tab for that product popped up. But I found no solution for the older products created prior to enabling comments, so I had to re-create them from scratch. Duplicating doesn't work either. I suspect it would be a simple change in the database if one knows where to look, but for me it was quicker to re-create.
Woocommerce products are essentially Wordpress custom post types, and for some reason WC chose to re-purpose the comments function for use in product reviews, which IMAO is a mistake as it will cause conflicts like this. In addition, people may want to have reviews globally enabled for their store, but comments globally disabled for their blog, instead you have to keep comments globally enabled and manually disable comments for each blog post. Very inconvenient.
Upvotes: 1
Reputation: 381
if you have done code perfectly but please do not to forgot the Enable reviews option from the admin side in product.
Here I have explain the steps for your reference. In admin side product data -> Advanced -> Enable Reviews
Upvotes: 6
Reputation: 31
You need to add this function and also check the comment is enable? Follow this link https://github.com/woocommerce/woocommerce/wiki/Declaring-WooCommerce-support-in-themes
function mytheme_add_woocommerce_support() {
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );
Upvotes: 3