Okay
  Public Ticket #3045030
Woo Commerce Previous/Next Single Product Pages
Closed

Comments

  •  12
    tombeckham started the conversation

    Hi Team,

    Does Salient have a built in on/off option somewhere for "previous/next" items in the single product page or should I seek adding via Functions PHP?


    Thanks

  •  1,877
    Judith replied

    Hi There,

    Thanks for keeping in touch.

    We don't have this feature at the moment, however you add using code by following this article:https://wordpressdeveloperonline.com/how-to-add-previous-next-button-in-single-page-in-woocommerce/.

    Thanks.

  •  12
    tombeckham replied

    Hi Judith, thanks for the link. It works for the most part, except that I can't seem to find why the Previous and Next are pushed up against each other. The css indicates "block" and float left/right, and I even tried inline-block with word-spacing and this doesn't seem to help.

    Any ideas why ? Sorry, I know you didn't write the css!

    Thanks again

  •  1,877
    Judith replied

    Hi There,

    Please send in your website url so that we may provide css for it.

    Thanks.

  •  12
    tombeckham replied

    Running local now  - will post link when live. Thank You!

  •  12
    tombeckham replied

    I found something that works


    add_action( 'woocommerce_before_single_product', 'Woocommerce_prev_next_btn_product' );
     
    // if you also want them at the bottom
    add_action( 'woocommerce_after_single_product', 'Woocommerce_prev_next_btn_product' );
     
    function Woocommerce_prev_next_btn_product(){
     
    echo '
    ';
     
        // '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 '
    ';
             
    }