• Resolved Livingstone

    (@livingstone)


    Hi guys. Could be knowing CSS that could remove sidebar from Woocommerce pages when I am using the Woocommerce plugin?

    • This topic was modified 7 years, 2 months ago by Livingstone.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello!

    Have you checked your theme’s options or inside the shop and product pages for an option to remove the sidebar? In most cases, theme developers offer such an option.

    If not, provide a link to your website.

    Thread Starter Livingstone

    (@livingstone)

    @broseph No option in the plugin (I am using woocommerce plugin and not a theme). In fact Woocommerce team referred me to wordpress forum for help

    WooCommerce itself won’t have such an option. And of course you have a theme. Plugins won’t work without a WordPress theme.

    The theme developers tweak WooCommerce in order to fit their theme’s design and functionality (if it’s mentioned that the theme is compatible with WooCommerce), so they have special options for WooCommerce, either in the Theme Options (usually found in Appearance -> Theme Options or Appearance -> Customize) or inside the WooCommerce pages, in the right sidebar or at the bottom, under Woo’s default boxes.

    Thread Starter Livingstone

    (@livingstone)

    No option in the theme that I am using. CSS below works. The only problem is that. The “view cart” button is inactive until one navigates to view cart page.

    add_action( ‘after_setup_theme’, ‘my_emmet_after_setup_theme’, 10 );

    function my_emmet_after_setup_theme() {

    // woocommerce page full-width
    remove_action(‘woocommerce_archive_description’, ‘mp_emmet_woocommerce_archive_description’, 10, 2);
    remove_action(‘woocommerce_after_main_content’, ‘mp_emmet_woocommerce_after_main_content’, 10);
    remove_action( ‘woocommerce_sidebar’, ‘woocommerce_get_sidebar’, 10 );
    remove_action(‘woocommerce_sidebar’, ‘mp_emmet_woocommerce_sidebar’, 10, 2);
    remove_action(‘woocommerce_before_single_product’, ‘mp_emmet_woocommerce_before_single_product’, 10, 2);

    function my_emmet_woocommerce_archive_description() {
    echo ‘<div class=”container main-container”><div class=”row clearfix”><div class=”col-xs-12 col-sm-12 col-md-12 col-lg-12″>’;
    }
    add_action(‘woocommerce_archive_description’, ‘my_emmet_woocommerce_archive_description’, 10, 2);

    function my_emmet_woocommerce_after_main_content() {
    echo ‘</div>’;
    }
    add_action(‘woocommerce_after_main_content’, ‘my_emmet_woocommerce_after_main_content’, 10);

    function my_emmet_woocommerce_sidebar() {
    echo ‘</div>’
    . ‘</div>’;
    }
    add_action(‘woocommerce_sidebar’, ‘my_emmet_woocommerce_sidebar’, 10, 2);

    function my_emmet_woocommerce_before_single_product() {
    echo ‘</div><!–container–></div><!– page-header–><div class=”container main-container”><div class=”row clearfix”><div class=” col-xs-12 col-sm-12 col-md-12 col-lg-12″>’;
    }
    add_action(‘woocommerce_before_single_product’, ‘my_emmet_woocommerce_before_single_product’, 10, 2);

    // Change number of products per page
    add_filter( ‘loop_shop_per_page’, ‘my_emmet_woocommerce_loop_shop_per_page’, 20 );
    function my_emmet_woocommerce_loop_shop_per_page($posts_per_page) {
    return 18;
    }

    }

    This is PHP, not CSS, and it’s out of my league :D.

    You should provide a link to your website, so someone can check the code and provide you a proper solution.

    It’s usually a simple CSS code based on display:none, not heavy PHP coding, but without a link to your website, no one can help.

    Thread Starter Livingstone

    (@livingstone)

    I got a simple trick performed via FTP. Very simple without adding a code. Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Removing Woocommerce Sidebar from pages’ is closed to new replies.