Site logo

Archived topic

Category view stripping formatting from Woocommerce Short Product Desc.

4 replies · Started by Michael on August 24, 2019

Viewing posts 1–5 of 5

I have just purchased the GP Premium and have an issue with category views of products.

The Category view is stripping formatting (<p></p> & <br>) from Woocommerce "Short Product Descriptions". The formatting shows correctly on the individual product page (pics below).

I am using TinyMCE and have selected the " Keep paragraph tags in the Classic block and the Classic Editor" option.

When trouble shooting I deactivated all plugins expect Woocommerce and got the same results.

Category view:
category view

Product view:
product view

The site I am working on is a staging site so I am unable to send a direct link.

here is the code:
<p>Ludger EB10 cartidges have been designed for purification of glycans from proteins, salts, and detergents.</p><p>Applications include cleanup of glycans following hydrazinolysis, endoglycosidase digests (including PNGase F digests), enzyme treatment, and before and after fluorescent labeling.</p>
<p>View product documentation as PDF<br>
View Certificate of Analysis as PDF</p>
<p>contains 6 cartridges</p>
<p>Part Number: LC-EB10-A6</p>

thank you in advance for any assistance you can offer.

Hi there,

The default Woo template doesn't display HTML in the archive summary. You can try this PHP snippet to hook in an excerpt that should display the HTML:

add_action( 'woocommerce_after_shop_loop_item_title', 'db_shop_html_summary', 20);

function db_shop_html_summary() {
	global $post;
	$desc = '<div class="category-desc">' .apply_filters( 'woocommerce_short_description', $post->post_excerpt ). '</div>';
	echo $desc;
	
	global $product;
	echo $product->list_attributes();
}

I added the recommended code to my child theme's functions.php but still have same results.

This should go in my child themes functions.php with no modifications, correct?

I have taken the site live...here is an example:
https://www.qa-bio.com/product-category/endoglycosidases/

I was able to fix it with the following added to child theme functions.php:

//allows html in short product descriptions to show on category page
function dhvc_woo_excerpt_custom($output,$post){
return do_shortcode($post->post_excerpt);
}
add_filter('dhvc-woo-excerpt', 'dhvc_woo_excerpt_custom',10,2);

Glad you found a solution

This archived topic is closed to new replies.