I am trying to: Just print product information for using toolset
Link to a page where the issue can be seen: hidden link
I expected to see: Short description and description with line breaks
Instead, I got: Text without line breaks
Hello,
i have another development site and same issue. Astra Pro theme without any custom code.
hidden link
br. Keijo
Hi Keijo,
Thank you for contacting us and I'd be happy to assist.
To troubleshoot and reproduce this on a test website, I'll need to see how this single product template is set up in the admin area.
Can you please share the temporary admin login details of this development website?
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
regards,
Waqar
Thank you for sharing these details.
During testing on my website, I was able to reproduce this behavior too. The 'Product Tabs' block is not applying the auto paragraphs to the product content/body.
I've shared these findings with the concerned team for further review. For now, you can use the following workaround code, to make this work:
add_filter( 'the_content', 'filter_the_content_in_the_main_product_loop', 1 );
function filter_the_content_in_the_main_product_loop( $content ) {
// Check if we're inside the main loop in a single product.
if ( is_singular('product') && in_the_loop() && is_main_query() ) {
$content = '[wpv-autop]'.$content.'[/wpv-autop]';
}
return $content;
}
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.
Hello,
Thanks for fast reply!
This solution will work with a field named "Description", but the "Short Description" field still has the same problem.
See attachment.
Br. Keijo
Thanks for the update.
For the shortcode description, WooCommerce uses the WordPress excerpts feature, which usually shows the text, without any auto paragraphs or formatting.
To make the automatic paragraphing work for the short product description field, you can include the following custom code:
function filter_the_excerpt_in_the_main_product_loop( $excerpt ) {
if ( is_admin() ) {
return $excerpt;
}
if ( is_singular('product') ) {
$excerpt = '[wpv-autop]'.$excerpt.'[/wpv-autop]';
}
return $excerpt;
}
add_filter( 'get_the_excerpt', 'filter_the_excerpt_in_the_main_product_loop', 999 );
Next, replace the Toolset's "Single Field" block with WordPress' "Post Excerpt" block in the template to show this short description.
Hello,
Short description is still without line breaks.
Br. Keijo
Looks like you missed the last step.
> Next, replace the Toolset's "Single Field" block with WordPress' "Post Excerpt" block in the template to show this short description.
I've included a "Post Excerpt" ( screenshot: hidden link ) block in the template and it is showing the excerpt with the line breaks ( screenshot: hidden link )
Hello,
Thanks! All good now.
Will your team fix this issue in the next Toolset update?
Br. Keijo
Glad that it worked.
It won't be possible to share any time estimate for the 'Product Tabs' block's issue, but we've published an erratum for it, with a more precise custom code:
https://toolset.com/errata/paragraphs-and-line-breaks-missing-from-product-description-when-using-product-tabs-block/
As for the excerpts, they are generally expected to show as plain text. So for anyone looking to show them formatted, the custom code can be used, on a case-to-case basis.