Remove Sidebar from Checkout, Cart and Product Page

May 2014 WordPress Theme
GK User
Fri May 29, 2015 10:09 am
Hello Gavick Team,

i´m new in Wordpress and Woocommerce.

I would like to remove the Woocommerce Sidebar from is_checkout() | is_cart() and from is_product page.

I think it´s possible with some code in the template file function.php.

I have tested this code in the function.php from the community:

function so_25700650_remove_sidebar(){
if( is_checkout() || is_cart() || is_product() ){
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
}
}
add_action('woocommerce_before_main_content', 'so_25700650_remove_sidebar' );

But it doesnt work...

Could you help me please?

Thanks!
Christian

Wordpress 4.2.2
Woocommerce 2.3.9
Gavick Storefront 1.4
User avatar
Fresh Boarder

GK User
Fri May 29, 2015 10:18 am
Sorry i mean "functions.php"...
User avatar
Fresh Boarder

GK User
Fri May 29, 2015 11:52 am
Hello,

I think that it will be easier to use i.e. Widget Logic plugin for widget on your woocommerce sidebar and put the conditional tags there:
Code: Select all
!is_checkout() && !is_cart() && !is_product()
User avatar
Moderator

GK User
Fri May 29, 2015 3:16 pm
great! thanks!
User avatar
Fresh Boarder


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.