Remove sidebar on single product pages
-
Hello there,
I would like to know if there’s a way i could remove the sidebar from the single product page,
You can find the site here
-
@admsimple if I look at this URL: http://simpleclothing.es/producto/black-camouflage-t-shirt/ I’m seeing that it’s showing no sidebar. Did you get this figured out?
If not, @jameskoster has addressed this topic here: https://wordpress.org/support/topic/remove-sidebar-from-all-woocommerce-pages-1/#post-7623814
Now, since you’ve mentioned specifically the
single-product.phppage, then you’ll want to add the WooCommerce conditional tag ofis_productto the code mentioned in the other thread. The result would be:add_action( 'init', 'jk_remove_sidebar' ); function jk_remove_sidebar() { if ( is_product() ) { remove_action( 'storefront_sidebar', 'storefront_get_sidebar', 10 ); } }Please post back if that worked as resolved (or blows up the innerwebs) 😉
Thank you for your answer, issue was previously resolved with Storefront Powerpack plugin wich allowed us to choose between fullwidth and default on shop and product pages!
-
This reply was modified 8 years, 7 months ago by
simpleve.
Simple way. Log into FTP. Go plugins, woocommerce, archive product & single product. Remove this code
<?php
/**
* woocommerce_sidebar hook.
*
* @hooked woocommerce_get_sidebar – 10
*/
do_action( ‘woocommerce_sidebar’ );
?>Hello,
I would like to bring this up again, because recent updates seem to contain changes which make the code not work anymore.
In my case I was able to come up with another solution to get rid of the sidebar on product pages./* Remove Sidebar */ add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 ); function woo_remove_product_tabs( $tabs ) { unset( $tabs['description'] ); // Remove the description tab unset( $tabs['reviews'] ); // Remove the reviews tab unset( $tabs['additional_information'] ); // Remove the additional information tab return $tabs; }Now we need to add the product description again:
/* Add Product Description */ function woocommerce_template_product_description() { wc_get_template( 'single-product/tabs/description.php' ); } add_action( 'woocommerce_single_product_summary', 'woocommerce_template_product_description', 30 );This might be the reason why I am not able to make it full width through CSS.
I tried several different solutions, none of them had any effect. Because I want to use the sidebar on customer and review pages, I would like to use this on single product pages only.Any help would be highly appreciated! Thank you so much!
Best regards,
-Björn
*EDIT:
Just went through my code again and found the error, the wrong hook. In the code for the product description the add_action needs to be replaced with this:
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_template_product_description', 10 );-
This reply was modified 7 years, 10 months ago by
gluecklichezwerge.
-
This reply was modified 8 years, 7 months ago by
The topic ‘Remove sidebar on single product pages’ is closed to new replies.
