Related products order by menu order…..

This topic has 2 replies, 2 voices, and was last updated 9 months, 2 weeks ago ago by Luca Rossi

  • Avatar: Jonathan
    Jonathan
    Participant
    February 7, 2024 at 10:58

    Hi.

    I have set up related products for my store but they are sorting randomly. Every time I refresh the page the order of the related products changes.

    https://prnt.sc/mxRMrWIfETqh

    I would like to sort them by custom order in the WooCommerce product menu.

    https://prnt.sc/qb-wLZdpXEh_

    I don’t see this option in the related products settings of the template. I also can’t find a code snippet on the internet to modify the default order of related products.

    Could you please help me?

    Thank you very much.

    1 Answer
    Avatar: Justin
    Luca Rossi
    Support staff
    February 7, 2024 at 12:52

    Dear Jonathan,

    We hope this message finds you well.

    We kindly request that you insert the following snippet of code into the functions.php file located within your child theme directory:

    
    add_filter('woocommerce_cross_sells_orderby', 'n2t_woocommerce_cross_sells_orderby', 100);
    function n2t_woocommerce_cross_sells_orderby(){
        // Options include: menu_order, title, date, price, sku
        return 'menu_order';
    }
    

    We trust that this addition will be beneficial to your setup.

    Should you have any further questions or require assistance, please do not hesitate to reach out.

    Warm regards,
    The 8Theme Team

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.