I'm trying to display a description of a WooCommerce single product, but the instead of displaying the correct description, the loop starts over again displaying the image, price, add to cart etc.

I've tried to find the answer for long time with no avail. I have used the WooCommerce template scripts and edit them; the_excerpt() will work but not the_content().

This is the template file I am currently using: https://github.com/woocommerce/woocommerce/blob/master/templates/single-product/tabs/description.php

the_content() is now the problem. Could it be my query or something? I have different way to query my products from index.php, but the archive-product.php is having the same as WooCommerce query has. Could this be the cause, even if it's in the single-product.php the problem?

I use this for the front-page.php:s product loop:

<div class="col-9 main-products">
    <?php echo do_shortcode('[products paginate="true" limit="30" orderby="popularity"]'); ?>

content-single-product.php, archive-product.php and single-product.php are the same as the WooCommerce template has.

It should display the description instead of looping over again. There are no error messages.

I've also used a different theme and the products display correctly, so the problem isn't in any plugins I am using.

1 Answer 1

echo wpautop(get_the_content());

This code fixed the problem! I found out the solution from here: Post content being duplicated by the_content(); by KreigD's answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.