Checkout Siderbar Non-Existent

I’m trying to figure out how to actually make sidebars work with Pro.

I’m trying to add a left sidebar to the WooCommerce checkout page.

  1. Created a Sidebar in Appearance > Sidebars. Assigned Cart widget and Recently Viewed widget to it.
  2. Checked off the Checkout page to assign the sidebar to that page.
  3. Changed the Checkout page template to Left sidebar, Content right. No effect.
  4. Change site-wide template to Left sidebar, Content right. This creates a sidebar on the checkout page, but nothing is in it.

Why does Pro make it so complicated to assign sidebars to individual pages? Are there plans to streamline this workflow? What am I doing wrong here?

Hello @co50,

Thanks for asking. :slight_smile:

On my local setup, I don’t see any issues assigning sidebars in Pro Theme. I have recorded a screencast that you can take a look for steps. Please take a look at the screencast and let us know how it goes. https://cl.ly/2w0a2h3v2J1P

Thanks

Did that - and even went beyond (changing site-wide default template to left sidebar). Didn’t get what you got.

I’ve just recorded a screencast mimicking what you did in your video, but with different results. See https://youtu.be/ZmdLmE4sKZs. BTW, this is the same result on every Pro site we have - not specific to this one.

Hey @co50,

It looks like you’re using Fullwidth Content Layout? The template with sidebar won’t work if you’ve set Fullwidth globally.

If that is not the case, please give us WP admin access in a Secure Note so we could check your setup.

Thanks.

You didn’t mention that part in your video. But I tried it that way anyway - sidebar did appear but was blank. Turns out I was thrown off by the fact that there is some type of bug where the Cart widget does not actually work - it won’t display their cart in the sidebar when it’s assigned - even with multiple items in it. Not sure that bug is with Pro, WP, or WooCommerce.

As I said in the original post, when the global content layout is set to Left sidebar, right content, the checkout page shows the sidebar on left, but problem is while all “normal” pages don’t show it…which is what we want…pages like the Blog, Cart, etc. show it…even though they aren’t checked off in the sidebar settings. It seems quite difficult to accomplish the simple task of assigning a sidebar to a single page. The proper workflow should simply be: 1) Create sidebar, add widgets to it. 2) Check off the pages you want it to appear on. 3) Change that page’s template to left sidebar. Why on earth must we switch the global layout? Makes no sense at all.

Hi there,

If the widgets isn’t appearing after adding it and assigning, then it could be an issue with the widget and from Woocommerce itself. The theme has no integration with any widgets, just a sidebar as a placeholder.

As for the layout, yes, I agree and it’s because global layout overrides everything. But we can change that behavior by adding this code to your child theme’s functions.php


  function x_get_content_layout() {

    $content_layout = x_get_option( 'x_layout_content' );

    if ( $content_layout != 'full-width' ) {
      if ( is_home() ) {
        $opt    = x_get_option( 'x_blog_layout' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_singular( 'post' ) ) {
        $meta   = get_post_meta( get_the_ID(), '_x_post_layout', true );
        $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout;
      } elseif ( x_is_portfolio_item() ) {
        $layout = 'full-width';
      } elseif ( x_is_portfolio() ) {
        $meta   = get_post_meta( get_the_ID(), '_x_portfolio_layout', true );
        $layout = ( $meta == 'sidebar' ) ? $content_layout : $meta;
      } elseif ( is_archive() ) {
        if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
          $opt    = x_get_option( 'x_woocommerce_shop_layout_content' );
          $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
        } else {
          $opt    = x_get_option( 'x_archive_layout' );
          $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
        }
      } elseif ( x_is_product() ) {
        $layout = 'full-width';
      } elseif ( x_is_bbpress() ) {
        $opt    = x_get_option( 'x_bbpress_layout_content' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( x_is_buddypress() ) {
        $opt    = x_get_option( 'x_buddypress_layout_content' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_404() ) {
        $layout = 'full-width';
      } else {
        $layout = $content_layout;
      }
    } else {
      $layout = $content_layout;
    }

     if ( is_page_template( 'template-layout-content-sidebar.php' ) ) {
        $layout = 'content-sidebar';
      } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) {
        $layout = 'sidebar-content';
      } elseif ( is_page_template( 'template-layout-full-width.php' ) ) {
        $layout = 'full-width';
      } 

    return $layout;

  }

The page layout/template will then override the global layout.

Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.