I'm using WordPress 4.9.4 running Twenty Seventeen Child Theme theme with Woocommerce Version 3.3.4. I am trying to remove the sidebar… I have tried using this:
remove_action('woocommerce_sidebar','woocommerce_get_sidebar',10);
But haven't found the right one yet.
How do I remove all sidebars?
The best and simple way that works with all themes is to use the get_sidebar
Wordpress action hook this way:
add_action( 'get_sidebar', 'remove_woocommerce_sidebar', 1, 1 );
function remove_woocommerce_sidebar( $name ){
if ( is_woocommerce() && empty( $name ) )
exit();
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.
You might need to make some CSS changes on some html related containers
This code works on any theme as all themes use get_sidebar()
Wordpress function for sidebars (even for Woocommerce sidebar) and get_sidebar
action hook is located inside this function code.