WooCommerce Grid / List toggle
Exclude from certain pages (5 posts)

  1. sparx
    Posted 3 years ago #

    I have a shop page that shows a list of categories before you go into the list of products. I don't want to show the toggle on this page as it is not needed, it's only needed once you go into each category of products.

    How do I disable it from showing on my main shop page?

    Many thanks,



  2. James Koster
    Plugin Author

    Posted 3 years ago #

    You'd need to query the depth of the archive then

    remove_action( 'woocommerce_before_shop_loop', array(&$this, 'gridlist_toggle_button'), 20);
  3. sparx
    Posted 3 years ago #

    Thanks, I tried adding that code to both my theme's functions and in the grid plugins php file, but nothing seems to happen.

    Any thoughts?

    Many thanks is advance,


  4. James Koster
    Plugin Author

    Posted 3 years ago #

    Sorry the code was wrong, try:

    if ( ! is_product_category() ) {
    remove_action( 'woocommerce_before_shop_loop', 'gridlist_toggle_button', 20);
  5. chronosMark
    Posted 3 years ago #

    Hi I've just tried using

    remove_action( 'woocommerce_before_shop_loop', 'gridlist_toggle_button', 20);

    and it dosen't work. Neither does trying to use add_action hook on another tag. Am I correct that just specifiying this in the functions.php of my theme should work?

    I'm trying to move the button to before the main content so I figured remove the action using the above and then do

    remove_action( 'woocommerce_before_main_content', 'gridlist_toggle_button', 20, 0);

    is this the correct way to go about it?



Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce Grid / List toggle
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.