How to display product summary from single product page in sidebar of Woocommerce?

In this tutorial we’ll learn how to display product summary from single product page to sidebar of woocommerce.

Here is the default product screen:

woocommerce

Now we need to display the bordered content in the sidebar.

To do this add the following lines of code in your theme’s sidebar.php file:

<?php

                if(is_product()) {

                                do_action( 'woocommerce_single_product_summary' );

                }

                ?>

You can access sidebar.php file here:

woocommerce

Place the code and click on Update File button to save it.

woocommerce

Now, if you’ll go to product page again you’ll see the product related content being displayed in sidebar.

woocommerce

You can remove the unnecessary content with CSS.

CHEERS J

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

Leave a Comment

Your email address will not be published. Required fields are marked *