WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Trying to remove sidebar from all Woo commerce Pages (45 posts)

  1. keysuuh
    Member
    Posted 1 year ago #

    I created a woocommerce.php file and replaced my theme's loop with//
    <?php woocommerce_content(); ?>
    It worked perfectly! My sidebar was then placed in the correct position.

    My issue is what it seems to be an invisible sidebar...
    I would like my WooCommerce pages to be full width.
    But each page template seems to have a huge gap on the right hand side (where my sidebar once was)

    I basically would really LOVE to find out what I can do in order to make all Woo Pages full width.

    I will paste whatever code needed in a pastebin, just not sure which, so please let me know!

    http://wordpress.org/extend/plugins/woocommerce/

  2. mariaarty
    Member
    Posted 1 year ago #

    try writing this code in the css theme editor
    .woocommerce #sidebar{display:none}

  3. Roy Ho
    Member
    Posted 1 year ago #

    It is not good idea to use CSS to hide things with display:none when there are better solution.

    You can try the function is_woocommerce() which will check if the current page is a woocommerce template...With that, you can wrap it around the code that displays the sidebar and negate the check so it won't display the sidebar on those pages.

    if ( ! is_woocommerce() ) { get_sidebar(); }
  4. keysuuh
    Member
    Posted 1 year ago #

    @splashingpixels.com I've deleted the sidebar div completely here is my woocommerce.php HTML//@splashingpixels.com I've deleted the sidebar div completely here is my woocommerce.php HTML//

    <?php get_header(); ?>
    	<div id="container" class="clearfix">
    		<div id="content-wrap">
    			<?php woocommerce_content(); ?>
    		</div>
    	</div>
    <?php get_footer(); ?>

    Should I still use the snippet you suggested in my woo file?

  5. Roy Ho
    Member
    Posted 1 year ago #

    No, if you could do it in the WooCommerce template, that is fine. My snippet is only for themes that have a custom template that displays the WooCommerce products page along with regular pages.

    But one suggestion for you is instead of deleting it since you "may" want it back at one day...Just comment it out...Wrap the section iwth /* and */ so it will be ignored.

  6. Cohesive Web Design
    Member
    Posted 1 year ago #

    I just fixed this on our website. You can take the sidebar out simply by commenting out the information in the woocommerce/templates/shop/sidebar.php file like splashing suggested. Simply put a /* and */ around everything there and it will take it out. If you need more help, drop me a line at http://www.cohesivewebdesigns.com and I'll be glad to help. But that should fix it.

  7. lauramba
    Member
    Posted 1 year ago #

    cohesiveideas - thanks for the post. This really cleaned up my shop.

  8. Cohesive Web Design
    Member
    Posted 1 year ago #

    You are very welcome! To say thanks, you should add our website link to your resources page ;)

  9. acknowledged74
    Member
    Posted 1 year ago #

    Crikey I've tried everything I can find on this but still can't get rid of the sidebar.

    1. Tried adding the following to the themes functions.php file

    remove_action( 'woo_main_after', 'woocommerce_get_sidebar', 10);

    2. Tried commenting out do_action('woocommerce_sidebar'); in archive-product.php

    3. I've copied the Template folder over to my theme Woocommerce folder, and in \templates\shop\sidebar.php and commented the content out.

    4. I even deleted the sidebar.php file completely

    but no change at all in my shop.

    Really don't get this please please help, the shop just looks a mess with the sidebar.

  10. Cohesive Web Design
    Member
    Posted 1 year ago #

    Make sure that your theme is not showing a sidebar on that page for some reason. The commenting out on the WooCommerce worked 100% for me even after the 2.0 updates. Go back and make sure that everything is 100% as stated above and not one single character is misplaced.

  11. acknowledged74
    Member
    Posted 1 year ago #

    My 1 to 4 has all been done as stated. remove_action( 'woo_main_after', 'woocommerce_get_sidebar', 10); for instance is copied and pasted directly from the page in question.

    The 'Shop' page which is automatically generated and doesn't have the short codes on its edit page that say 'checkout' page does with [woocommerce_checkout]

    All the other pages

    Cart
    Checkout
    Checkout → Pay
    Order Received
    My Account
    Change Password
    Edit My Address
    Lost Password
    View Order
    Track your order

    Have a shortcode, and allows me to use the theme options and choose to have 'full width' but the 'shop' page doesn't allow any control like this.

    I have read that the 'shop' page (which also serves as the template for the category's pages, and single product pages) is an archive not a page?

    One thing I would say Cohesive is that on the sidebar.php which looks like

    ?*<?php
    /**
    * Sidebar
    *
    * @author WooThemes
    * @package WooCommerce/Templates
    * @version 1.6.4

    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

    get_sidebar('shop'); */ ?>

    The <?php ... ?> can't be commented out, I can't see why that would matter though?

    Oh something I should point out is that the theme is Woo ready, and has its own Woocommerce folder already.

    Really stuck on this one.

  12. Cohesive Web Design
    Member
    Posted 1 year ago #

    I don't think our theme is WooCommerce ready but another client of our has a WooCOmmerce ready theme. You might want to dig through the theme folder and see if there is a ProductPage.php file or something that is controlling the footer. Sometimes WooCommerce ready themes do that. So even if you made the change in WooCOmmerce, the theme would override it.

    We aim to produce the most cohesive websites that we can when we build them.

  13. suzt808
    Member
    Posted 1 year ago #

    This is what I used/ added to my functions.php file to remove the sidebar on all pages

    /**
     * WooCommerce
     *
     * Unhook sidebar
     */
    remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10);

    HTH

  14. willyharrymyhero
    Member
    Posted 12 months ago #

    Thanks Mariaarti, your idea worked perfectly for me!
    .woocommerce #sidebar{display:none}

  15. kwatts22
    Member
    Posted 11 months ago #

    Here is how to remove the sidebar.

    go to wp-content/plugins/woocommerce

    in file single-product.php remove the following code

    <?php
    		/**
    		 * woocommerce_sidebar hook
    		 *
    		 * @hooked woocommerce_get_sidebar - 10
    		 */
    		do_action('woocommerce_sidebar');
    	?>

    next edit the file archive-product.php and remove the following code

    <?php
    		/**
    		 * woocommerce_sidebar hook
    		 *
    		 * @hooked woocommerce_get_sidebar - 10
    		 */
    		do_action('woocommerce_sidebar');
    	?>

    next we have to edit the style.css in your theme folder
    find
    #content-woocomerece
    add the following before the } tag on the last line
    width:100%;

    NOTE: You can not add the /* */ to the line it will not comment it out.

  16. donreyvargas
    Member
    Posted 11 months ago #

    hi,

    i wonder this solution works, as i need my WooCommerce sidebars to be removed.

    it looks ugly.

    here is my WEBSITE.

    http://holidaycrafts.com.au/shop/

    Cheers,
    boie

  17. kwatts22
    Member
    Posted 11 months ago #

    As long as your running the newest version of woocommerce it will work. Also keep a backup of your original file before you edit them just in case so that you can restore it back if something goes wrong.Make sure you do the edit in your themes stylesheet or it will only show the main content for half the page. If you need any help let me know.

  18. kwatts22
    Member
    Posted 11 months ago #

    If you forget to make backups of your files just download woocommerce again extract it and then take the files out.

  19. ickysniffles
    Member
    Posted 10 months ago #

    Hi. Been doing searches for this specific issue of mine with no satisfactory results. I hope I am in the right place for this. If not, my apologies. Issue: When logged in as any user and I go to the "my account" page in the woocommerce, my sidebar gets an additional widget that has the following: change password, edit my address, logout, lost password and view order.

    What I would like to do is be able to take out the "lost password". Being as the user is logged in already, to me, it would make sense that you would not need to do this. So I guess my question is, where is the code for this "ghost widget" that I cannot seem to find. I have performed several different types of searches inside the "woocommerce" plugin folder and any changes i have done seem to have no effect on the output. I am confident that when I do find the code that I will be able to correct this myself. I just cant find it. Thanks in advanced for any advise.

  20. ickysniffles
    Member
    Posted 10 months ago #

    Ok, so the power of writing to people has opened my mind once again. Just realized that this "ghost widget" of mine is listing the "sub-pages" under the "my account" page. So while I have solved my issue in "hidding" the "lost password" option, I still would like to know where this code is getting inserted at. Once again, thanks for any advise.

  21. evanspj
    Member
    Posted 10 months ago #

    Hello kwatts22 and others,

    I have done the first two steps of what you suggested (the single-product.php and the archive-product.php)

    but I am stuck on the third

    next we have to edit the style.css in your theme folder
    find
    #content-woocomerece
    add the following before the } tag on the last line
    width:100%;

    NOTE: You can not add the /* */ to the line it will not comment it out.

    What style.css file to I edit? I have relatively new to WP and have created a child them based on the Twenty Eleven theme. I have looked in the Twenty Eleven child theme and the original Twenty Eleven them and I can't see any line that contains "#content-woocomerece"

    Any assistance would be gratefully received.
    Peter Evans

  22. kwatts22
    Member
    Posted 10 months ago #

    hi evanspj post a link to your website

  23. zfields
    Member
    Posted 10 months ago #

    I'm also not seeing that last line in part 3 Kwatts22.

    Using one of the actual woocommerece themes. Honestly at this point thinking about just dumping woocommerece, doesn't seem nearly as "flexible" as they claim at this point.

  24. evanspj
    Member
    Posted 10 months ago #

    Hello kwatts22,

    Thanks for your speedie reply but i am not sure where to look for your comment ... could you either post it here or use the contact form on emarkingassistant.com

    thanks for your assistance,
    Peter Evans

  25. evanspj
    Member
    Posted 10 months ago #

    kwatts22,

    Opps I did not fully read your last post ... here is a link to a sample product page that I would like to extend 100% of the width of the window.
    http://emarkingassistant.com/product/sample-product-only/

    I would like to remove the side bar from all the woocommerce pages.

    I have added

    #content-woocommerce {
    width: 100%;
    }

    to the style.css in my child theme but the content still does not extend 100% of the window.

    I have commented out the relevant lines in single-product.php and archive-product.php and the sidebar no longer appears on the page.

    Thanks in advance for any assistance,
    Peter Evans

  26. kwatts22
    Member
    Posted 10 months ago #

    Hi Evan,

    I am looking at the site right now.

  27. kwatts22
    Member
    Posted 10 months ago #

    I got a answe for you edit your style.css located in wp-content/themes/twentyeleven

    on line 90 you will see the following

    #content {
    	margin: 0 34% 0 7.6%;
    	width: 58.4%;
    }

    change that to this

    #content {
            margin: 0 auto;
            width: 90%
    }
  28. kwatts22
    Member
    Posted 10 months ago #

    That will leave room for the other pages that still use the sidebar

  29. evanspj
    Member
    Posted 10 months ago #

    kwatts22

    Yes. If I add

    #content {
            margin: 0 auto;
            width: 90%
    }

    to the style.ccs I can see that it will extend the content area on the product page the full width of the window ... and this is GOOD.

    But I still want the sidebar to show on the other pages on my site. Is there a way to hide remove the sidebar on only the woocommerce pages and still have it shown on the other pages of my site?

    I can use WIDGET AREAS to control what area is shown on the pages but the content area still does not extend 100% of the width even if nothing is in new area.

    Peter

    Peter

  30. kwatts22
    Member
    Posted 10 months ago #

    here is a workaround because your using the twenty eleven theme which don't have a full width temple without the sidebar.

    Create a file in wp-content/theme/twentyeleven and name it woocommerce.php

    add this to it

    <?php
    /**
     * The template for displaying all pages.
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages
     * and that other 'pages' on your WordPress site will use a
     * different template.
     *
     * @package WordPress
     * @subpackage Twenty_Eleven
     * @since Twenty Eleven 1.0
     */
    
    get_header(); ?>
    
    		<div id="primary">
    			<div id="content-fullwidth" role="main">
    
    			<?php woocommerce_content(); ?>
    
    			</div><!-- #content -->
    		</div><!-- #primary -->
    
    <?php get_footer(); ?>

    then in your style sheet located in the same folder add on line 94

    #content-fullwidth{
        margin-left: 20px;
    	width: 90%;
    }

    The new page template for woocomerce will now use a container-fullwidth which will take the whole page instead of only half and will only work on the woocommerce pages.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic