Adding shop sidebar in single product page - woocommerce

I'm really struggling to add a sidebar in the single product page in Woocommerce. I would like to add a sidebar that could display the shop widget. Is this possible to do? It's a custom theme that I have limited knowledge of.

Related

Woocommerce Products and Category pages have different templates from other WC pages

I have a website that is using WooCommerce to sell items. Here is my demo site:
http://demo.bergdahl.com/
You can see the ecommerce pages and their layouts here:
Layout 1 (left and right sidebars):
Products list: http://demo.bergdahl.com/shop/
Category page: http://demo.bergdahl.com/product-category/catridges/
Layout 2 (right sidebar only):
Single product page: http://demo.bergdahl.com/product/6-oz-catridge/
I have gotten it so that most of the WooCommerce pages use have layout 1 except the single product page that has layout 2. Layout 2 is set to be the default layout in the theme and applies to the other 170 pages of the site. I don't want to change the default layout, I just want to find out what page I can use to set the layout for the single product page.
Basically, I would like to have all WC pages use layout 1.
My question is, how does WooCommerce chose which layout is assigned to which type of page?
It seems like the Product list and the Category pages are pulled in from the blog page layout. The Cart, Checkout, and My Account pull from their actual pages. I am not sure how to set the layout in the single product page.
P.S. - This site uses an older theme with no WC support. I don't know if this may be the problem but I could only adapt the theme by using the woocommerce_content() method listed here: https://docs.woocommerce.com/document/third-party-custom-theme-compatibility/?utm_source=notice&utm_medium=product&utm_content=themecompatibility&utm_campaign=woocommerceplugin
You can override the singe product template.
To override the single product template, copy:
wp-content/plugins/woocommerce/templates/single-product to
wp-content/themes/Builder/woocommerce/single-product
There is an official documentation for WooCommerce theme override at Template Structure + overriding templates via a theme.
Thanks to Lax, I found a way around it. I actually used the woocommerce.php that I created out of my theme's page.php. This got it out of the same container that the product was in.
I then used the dynamic_sidebar('sidebar_name_here') to display the sidebar on that page . The full code I used was:
<?php if(is_product()){?>
<div class="store-sidebar-left">
<?php dynamic_sidebar('store-sidebar-left');?>
</div>
<?php } ?>
This allows it to only show on the single product page.
I had one small problem where I couldn't find the name of the sidebar in my theme or my database so I just created a new on in my functions.php file and used that one.

How do I set multiple custom templates for the Shop page in Woocommerce?

I would like to let the user choose between different templates, such as full with or content with sidebar for the Shop page, but the problem is that the shop page always uses the archive-product.php template.
Thank you
Make a regular (not shop) page and add this shortcode:
[products orderby="menu_order"]
Other options to customize are available here:
https://docs.woocommerce.com/document/woocommerce-shortcodes/
To make your different templates, just make custom page templates as you would for any page:
https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/
...And then select the template from the Page Attributes menu for that page, typically on the right about half way down. Now you can set up different shop pages with different text and layouts, and the savvy client can change between the templates you build.
Also note, when you use the shortcode above for a custom shop page, you can put in-page CSS. Just wrap it in <style</style> tags, though many frown on that practice.

How to make sidebar and filter in Product-Category Page?

I am newbie in woocommerce.
Currently, I am using the GreatStore theme in Wordpress.
And I am trying to make filter by size of the tablet on the top and make sidebar.
But I do not know how to do that and the theme seems no offer for that. (No sidebar widget in product-category page)
Can anyone tell me how can I make those in Product-category page?
This is the page: http://dev.myhexa.com/product-category/Windows/
Thanks,
You will have to override the current product category page.
Create a new file taxonomy-product_cat.php.
For reference -
https://www.skyverge.com/blog/how-to-override-woocommerce-template-files/
https://www.woothemes.com/2014/08/five-quick-woocommerce-customization-tips/

Woocommerce settings effect on page layout

when I set woocommerce setting for shop to display categories. the layout is ugly yet when the same setting is display products.the layout is fine. how can I have a good layout with display categories option set?
If I understand the question correctly, you want to display categories among the products in the archive view.
If that is the case, you should use the content-product_cat.php template in wp-content/plugins/woocomemrce/templates/. Copy this template into your theme's woocommerce folder(create it if it does not exist).

Same widgets on each page Wordpress

How can i avoid same widgets on each page.I add widget on sidebar in widget area but it appears on all the pages having sidebar.I want different widgets on different pages sidebars.How can i do this.I am new to wordpress.
This can be done with the Jetpack plugin. Once activated you can choose what widgets display on what pages:
The Widget Visibility module enables you to configure widgets to appear only on certain pages (or be hidden on certain pages) by using the Visibility panel.
Visibility is controlled by five aspects: page type, category, tag, date, and author. For example, if you wanted the Archives widget to only appear on category archives and error pages, choose “Show” from the first dropdown and then add two rules: “Page is 404 Error Page” and “Category is All Category Pages.”
I prefer the Custom Sidebars plugin. It comes with less overhead than Jetpack, but if you need any of the other features Jetpack provides: go for it!
You can use the Display Widgets WordPress plugin. It is a super light weight plugin and will do exactly what you want!

Resources