I need to remove a filter that sets the template of my results, in this case, it uses UL to organize the content. I don’t need this.

  • Case 1) Remove this and my code takes care os the layout
  • Case 2) Apply another filter to set my own template.


  • line 192
echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' );
  • line 199
echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>');

There is another element that comes from the hook, but this one I couldn’t found the place it comes from, my rendered html shows it:

<div class="listaprodutos"><h2 class="widgettitle">Produtos</h2>
<ul class="product_list_widget">

My goal is remove all these two settings (widgettitle and product_list_widget).

I add this lines in my functions.php page, but it didn’t work:

// Remove UL format for products_widget

remove_filter( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' );
remove_filter( 'woocommerce_after_widget_product_list', '</ul>' );


<p class="display-4" style="text-align:center">Produtos mais vendidos</p>

<div class="container">

      <?php if ( is_active_sidebar( 'listaprodutos' ) ) : ?>
        <?php dynamic_sidebar( 'listaprodutos' ); ?>
      <?php endif; ?>



<div class="container"> 
  <div class="row">
    <div class="col-md-4">

              <div class="card" style="width: 19rem; margin-bottom:3rem; margin-top:3rem;">

                <img class="card-img-top img-fluid" src=<?php echo $product->get_image(); ?> 

                <div class="card-block">
                    <h4 class="card-title"><?php echo $product->get_name(); ?></h4>
                    <p class="card-text">
                        <?php echo $product->get_price_html(); ?>
                    <a class="btn btn-quick" href="<?php echo esc_url( $product->get_permalink() ); ?>">Ler o post</a>

Read more here: apply_filters (how to remove this filter already added) – woocommerce


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: