I have a problem with Woocommerce to find a good solution, I am looking to have my line breaks in this product extract space. I would also like to be able to use lists.
Despite my search in the plugin, I can’t find any strip_tags that could be the cause of removing them, and also overriding a filter, I have tested many codes by going through Google without success.
This solution not working for me.
woocommerce product excerpt description (short)
2
Answers
I just went into the template editor and replaced the product extract with the description, I'll see if it's possible to go through an ACF block. I'm not yet very familiar with the template editor
The short description is controlled by the short description input field for each product. So you can make your changes there for each product which require some manual work.
However, you can automatically convert each sentence in the short description into a list item. One way you can achieve this by adding a function to split the description at each period (".") symbol, and wrap each resulting sentence in
<li>
tags.The below code will:
wpautop
filter: removes the automatic paragraph tags added by WordPress..
) symbol. It is important that you add the period symbol at the end of each sentence, as this is what determines where the list tag ends.<li>
tags.<ul>
).I have tested this code and it works on my end. You should add it in the
functions.php
file of your active child theme.Removing this code will revert back to normal settings.