A sidebar in WordPress is referred to a widget-ready area used by WordPress themes to display information that is not a part of the main content. It is not always a vertical column on the side. It can be a horizontal rectangle below or above the content area, footer, header, or anywhere in the theme.
To remove sidebar from product archives page you need to add the following lines of code in your theme's functions.php
file.
add_filter( 'body_class', 'remove_sidebar' );
function remove_sidebar()
{
if( is_product_category())
{
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
}
}
To remove sidebar from cart, checkout and single product or product detail page you need to add the following lines of code in your theme's functions.php
file.
add_action('woocommerce_before_main_content', 'woo_remove_sidebar' );
function woo_remove_sidebar()
{
if( is_checkout() || is_cart() || is_product() )
{
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
}
}
Never miss the latest offers, voucher codes and useful articles delivered weekly in your inbox.