Move related product to the sidebar on Woocommerce single products


New Member
In woocommerce product page, i would like remove the related product on the product bottom page and put it on sidebar.
I can remove it (on the bottom) with:
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
and add it in sidebar a widget [related_products]. But if I do it like this, I remove all related product.
Have you got an idea, how I could do it?


Thành viên BQT
It just change the location of the related products… Here are the steps:

1) add the following code in your active child theme function.php file (only):

remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products',20);
2) In backend settings "Appearance" > Widgets:

  • Add a Text widget to your product sidebar
  • Edit and paste inside the text editor the shortcode [related_products per_page="3" columns="1"]
  • Save.

Then you will get something like:


Từ khóa phổ biến

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.