Reputation: 13
For some reason in my shop pages the short description of each product has appeared beneath each product title. I have tried coding this out using:
body.page-id-7 .woocommerce-product-details__short-description {
display: none !important;
However, I have found online that due to it being a WooCommerce page this page ID I have used is not correct.
What is the correct way to remove the product short description from the main shop page?
If anyone knows how to do this please explain in simple terms! I am not the most knowledgeable with code so a step by step would be wonderful.
I still want the product description to be visible on the individual product pages.
Please see my site to see what I am talking about.
Upvotes: 1
Views: 7638
Reputation: 405
I added woocommerce/single-product/short-description.php to my theme from the woocommerce plugin then changed the code at the bottom to this:
<?php if ( is_product() ) : ?>
<div class="woocommerce-product-details__short-description">
<?php echo $short_description; // WPCS: XSS ok. ?>
</div>
<?php endif; ?>
I'd prefer to do it with a hook but I wasn't able to find a better solution.
is_product();
Is true if you are on the single product page.
You can get the file from https://github.com/woocommerce/woocommerce/blob/master/templates/single-product/short-description.php
Upvotes: 1
Reputation: 24
If I understand correctly what you want to achieve, you must add this code to your CSS file:
body.archive .woocommerce-product-details__short-description {
display: none;
}
It will looks like this:
Upvotes: 1