WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a theme and don't want to display the sidebar on single-product's page.

Following the recommendations of WooCommerce, I made a copy of "templates" folder (under woocommerce plugin) and installed on mytheme/templates, changing the folder's name to "woocommerce". On my theme's root, I created a file called sidebar-shop.php.

By now I have the sidebar displayed on the shop page and on the single-product page. I tried to remove do_action('woocommerce_sidebar'); from woocommerce/single-product.php and also tried to create a conditional on woocomerce/shop/sidebar.php, something like:

if (!is_page('single-product') { 

but the sidebar remains.

Is there a working option to remove only the single product sidebar?

share|improve this question
i think u need to add this line also on the single-product template file - remove_action( 'woo_main_after', 'woocommerce_get_sidebar', 10) – Shazzad Jan 4 '14 at 3:24
Tried but not worked. – audaz802 Jan 4 '14 at 3:55
up vote 1 down vote accepted

The conditional tag for single products is is_product()

add_action('template_redirect', 'remove_sidebar_shop');
function remove_sidebar_shop() {
if ( is_product('add-page-i.d-here') ) {
    remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar');

You may also want to change the layout on that product page to full width to remove the gap and reduce the width of the content area using a custom body class which you can also generate conditionally.

Woo Commerce conditional tags http://docs.woothemes.com/document/conditional-tags/

share|improve this answer
is_product() is just a wrapper for is_singular('product'). So, both works exactly the same. – Abhik Jan 4 '14 at 12:31
You would need to add the single product page slug if ( is_product('t-shirt') ) { – Brad Dalton Jan 4 '14 at 12:36
And how if I want to remove it for all products? I mean, no specific ID – audaz802 Jan 5 '14 at 22:15
if ( is_product() ) { – Brad Dalton Jan 5 '14 at 22:28

Here it goes..

function remove_sidebar_shop() {
    if ( is_singular('product') ) {
        remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar');
add_action('template_redirect', 'remove_sidebar_shop');
share|improve this answer
Abhik, the code looked promissing but not worked too. Wonder if "product" is the real ID of single-product page. Thank you anyway. – audaz802 Jan 4 '14 at 3:58
@serranegra my bad. init is too late to remove the action. Code corrected and should work fine now. – Abhik Jan 4 '14 at 6:34
function remove_storefront_sidebar() {
    if ( is_product() ) {
    remove_action( 'storefront_sidebar', 'storefront_get_sidebar', 10 );
add_action( 'get_header', 'remove_storefront_sidebar' );

It works with latest woocommerce 2.5.2 Also CSS needed:

.single-product.right-sidebar .content-area {
  float: none;
  margin-right: 0;
  width: 100%;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.