Okay
  Public Ticket #2565210
Moving the Single Product Navigation to the top
Closed

Comments

  • jfung started the conversation

    Hi,

    Currently the single product navigation appears after the product summary. It looks nice, but we have received feedback about it being inconvenient when clients just want to keep browsing through the products but they have to scroll down a bit every time to click the previous/next buttons.

    So we would like to move the single product navigation to the top, above the product title.

    I've tried the following codes, which works, but when I tested the buttons, their previous/next products are different from the ones in the single navigation product buttons.


    //Add Single Product Navigation to above Product Title

    add_action( 'woocommerce_before_single_product', 'bbloomer_prev_next_product' );
     
    function bbloomer_prev_next_product(){
     
    echo '<div class="prev_next_buttons">';
     
    // 'product_cat' will make sure to return next/prev from current category
        $previous = next_post_link('%link', '< Previous', TRUE, ' ', 'product_cat');
        $next = previous_post_link('%link', 'Next >', TRUE, ' ', 'product_cat');
     
        echo $previous;
        echo $next;
        
     echo '</div>';
     }

    Is there an easier way to call the current single product navigation function before the product title?

    Maybe something like:

    add_action( 'woocommerce_before_single_product', 'single_product_navigation' );


    Please advise!

    Thanks!


  •  895
    TheFox replied

    Hello Jfung,

    We will ask our dev team and get back to you tomorrow.

    Thanks for your patience.

    Best regards