How To Remove Unwanted Widgets In WooCommerce

Here we learn about how to remove unwanted widgets in WooCommerce.

You can unregister of default WooCommerce widgets class names.

I found widget names directly from the code here: woocommerce\includes\wc-widget-functions.php.

Syntax :

<?php unregister_widget( string|WP_Widget $widget ); ?>

It is useful for un-registering default widgets. and this executes with a function hooked ‘widgets_init’ action.

Custom code copied and paste into your child theme’s functions.php file.

If you remove ‘Filter Products by Rating’ widget. see the below example.

Example:

<?php
add_action( 'widgets_init', function(){
  unregister_widget( 'WC_Widget_Rating_Filter' );		
});
?>

The following list of WooCommerce widgets.

  • unregister_widget( ‘WC_Widget_Cart’ ) – For Cart.
  • unregister_widget( ‘WC_Widget_Layered_Nav_Filters’ ) – For Active Product Filters.
  • unregister_widget( ‘WC_Widget_Layered_Nav’ ) – For Filter Products by Attribute.
  • unregister_widget( ‘WC_Widget_Price_Filter’ ) – For Filter Products by Price.
  • unregister_widget( ‘WC_Widget_Product_Categories’ ) – For Product Categories.
  • unregister_widget( ‘WC_Widget_Product_Search’ ) – For Product Search.
  • unregister_widget( ‘WC_Widget_Product_Tag_Cloud’ ) – For Product tag Cloud.
  • unregister_widget( ‘WC_Widget_Products’ ) – For Products.
  • unregister_widget( ‘WC_Widget_Rating_Filter’ ) – For Filter Products by Rating.
  • unregister_widget( ‘WC_Widget_Top_Rated_Products’ ) – For Products by Rating.
  • unregister_widget( ‘WC_Widget_Recent_Reviews’ ) – For Recent Product Reviews.
  • unregister_widget( ‘WC_Widget_Recently_Viewed’ ) – For Recent Viewed Products.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories