Move related product to the sidebar on Woocommerce single products

wavemill

New Member
#1
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:
Mã:
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?
 

Admin

Administrator
Thành viên BQT
#2
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):

Mã:
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.
b8XtG.png

Then you will get something like:

5Hsg7.png
 

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.

Top