I want to disable the sidebar completely from WooCommerce single product page, and make the page full width.
I have read and tried each and every document available but to nothing is available.
Steps:
-
Copied the following code to functions.php
function remove_sidebar_shop() { if ( is_product() ) { remove_action('woocommerce_sidebar','woocommerce_get_sidebar'); echo("Test if"); } else { echo("Test else"); } } add_action('get_header','remove_sidebar_shop');
(the echo parts were for debugging)
-
Commented the line
do_action('woocommerce_sidebar');
inarchive-product.php
after copying it tomy-theme/woocommerce
. -
Commented the line
do_action('woocommerce_sidebar');
insingle-product.php
after copying it tomy-theme/woocommerce
. -
Commented the whole
sidebar.php
file.
But nothing seems to work.
After hours of head scratching, found a solution myself,
In the overridden single-product.php, till now i was commenting the line
But instead, commenting this line
did the trick.
Cheers….