Sidebar not showing in Shop Page Woocommerce, WordPress

I am quite desperate here trying to solve this. I am customizing a WordPress Tisson Pro Theme to be WooCommerce ready (it is not). I already did what is suggested related to “Third party / custom / non-WC theme compatibility”, doing it in my own Child-Theme, and 1 million things more… But the sidebar still looks not loading in the Shop Page! I inspected the code, and looks like the problem is the following;

woocommerce.php

Read More
<?php get_header();
$sidebar = mfn_sidebar_classes();

?>
<!-- Content -->
<div id="Content">
    <div class="container">
        <!-- .content -->
        <?php
            //open div
            if( $sidebar ) echo '<div class="content">';
            //get woocommerce content
            woocommerce_content();
            if( $sidebar ){
                //close div
                echo '</div>';
            } else {
                echo '<div class="clearfix"></div>';
            }
        ?>
        <!-- Sidebar -->
        <?php
            if( $sidebar ){
                get_sidebar();
            }
        ?>

    </div>
</div>
<?php get_footer(); ?>

The code is not entering if( $sidebar ), somehow I cannot figure out why! I tried everything with no luck.

Please if you could help me I will really appreciate it 🙂

Related posts

Leave a Reply

2 comments

  1. From the WooCommerce Third Party Theme Compatibility docs, you should be able to just define your wrappers… which looks like a <div class="content"> as far as I can tell. If you use these wrappers in functions.php then you do not need a woocommerce.php.

    add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
    add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);
    
    function my_theme_wrapper_start() {
      echo '<div class="content">';
    }
    
    function my_theme_wrapper_end() {
      echo '</div>';
      echo '<div class="clearfix"></div>';
    }
    
  2. Try this ..

    # WOOCOMMERCE CONNECT
    remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
    remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
    add_action( 'woocommerce_before_main_content', '_woocommerce_output_content_wrapper', 10 ); 
    add_filter( 'woocommerce_show_page_title', 'no_title' );
    function no_title(){
        return false;
    }
    function _woocommerce_output_content_wrapper(){
        echo '<div class="content"><div class="entry-content">';
        genesis_do_breadcrumbs();
        echo '<h1 class="entry-title" itemprop="headline">';
        woocommerce_page_title();
        echo '</h1>';
    }
    

    >> MORE DETAILS HERE

    Codes above will work only if the default hooks is not remove or re-positioned to different functions.

    May I know your current shop URL ? In genesis, there’s a page settings which you can select a page layout. You should choose sidebar-content or content-sidebar. Then on widgets, your primary sidebar must have atleast one widgets so you will see the results. The problem on genesis and woocommerce structure is not the same. All you need to do is wrap the woocommerce HTML with the <div class="content"><div class="entry-content">. The structure should be like this

    <div class="content">
        <div class="entry-content">
            <woocommerce HTML>
        </div>
    </div>
    <sidebar>sidebar</sidebar>
    

    If the alignment is still not correct, then the problem is on your CSS codes. Second option is override you woocommerce file to your current theme and no need for using hooks in functions.php. Hope this will help you.