LazerCats557 Sep 11, 2018 · 6:25 pm #10503 Hi guys,
My client wants a sidebar on the single product page in woocommerce which was on by default on their old site. I can get the sidebar to display on the shop page but I cannot get it to display in the single-product page for the actual product. My client wants this side bar so they can include essential information for the buyer before purchasing.
It appears that the theme somehow has this hidden or turned off because every attempt to add the sidebar to single product pages has failed. I have tried plugins and even php edit on child theme’s unsuccessfully.
Thanks in advance,
Jared
Andrew Misplon Puro Sep 11, 2018 · 6:49 pm #10504 Hi Jared
Thanks for posting. Polestar doesn’t offer a sidebar on single product pages. I’ll get back to you with a child theme solution. Chat then 🙂
Andrew Misplon Puro Sep 12, 2018 · 11:05 am #10509 Please, find a child theme solution here: https://purothemes.com/wp-content/uploads/2018/09/polestar-child-wc-single-sidebar.zip
If you’re currently using a child theme, download the above and take a look at the changes I’ve made and integrate them into your child theme.
If you aren’t using a child theme at the moment then you’ll install this child theme from Themes > Add New > Upload Theme. To migrate your settings from the parent to the child, please see: https://purothemes.com/customizer-settings-export-import/.
LazerCats557 Sep 13, 2018 · 10:04 pm #10534 Thanks Andrew. It did successfully add the side bar. The only other challenge is that I need it on the right hand side. What do I need to do to make that happened. I tried to change it in customizer and it didn’t work.
Thanks again man,
Jared
Andrew Misplon Puro Sep 14, 2018 · 8:32 am #10535 You’ll need to make a small edit to the functions.php file in the child theme. The easiest would be to remove the polestar_child_body_classes function and replace it with the following:
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function polestar_child_body_classes( $classes ) {
// WooCommerce sidebar.
if ( is_active_sidebar( 'sidebar-shop' ) && ( function_exists( 'is_woocommerce' ) && is_woocommerce() && is_product() ) ) {
$classes[] = 'woocommerce-sidebar';
if ( get_theme_mod( 'woocommerce_sidebar_position' ) == 'right' ) {
$classes[] = 'woocommerce-sidebar-right';
}
}
return $classes;
}
add_filter( 'body_class', 'polestar_child_body_classes' );