How to move related products section before reviews in Woocommerce

  • Open
  • gagandeep
    Participant
    October 8, 2019 at 9:27 am #3371
    gagandeep

    Hi
    I am working with the woocommerce plugin. I currently have the product, reviews and then it’s related products in the product detail page. I would like to change the display order.

    I want to display product, it’s related products and then it’s reviewing. I have tried changing the priority in functions.php but it doesn’t work. Any suggestions.

  1. Manik Malhotra
    Keymaster
    Posts: 38
    October 8, 2019 at 9:31 am #3374
    Manik Malhotra

    The review section is located in woocommerce product tabs by default. The following code will move related products section before that product tabs:

    add_action( 'init', 'move_related_products_before_tabs' );
    function move_related_products_before_tabs( ) {
    remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
    add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 5 );
    }
  2. Pankaj Sharma
    Participant
    Posts: 124
    October 9, 2019 at 6:47 am #3381
    Pankaj Sharma

    Great, this solution is working for me.

    Thanks Manik.