• Resolved luamaralstudio

    (@agpashion)


    I’ve been looking for a fix for this for a long time and couldn’t find it.

    I’d like to add a snippet to my website to change the related product to always display the most recent related products, not the oldests.

    I don’t understand why they use this “oldest in the same category” in the first place. That way people will forever see the same products there.. :/ That’s been happening on my shop for a year.

    Would appreciate some help! Thank you so much!

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Margaret S. woo-hc

    (@margaretwporg)

    Hi @agpashion

    In your theme’s related.php file, find the line of code that is similar to:

    $args = array('post_type' => 'product','posts_per_page' => '4','orderby' => 'date', 'post__not_in' => array(get_the_ID()) );

    Over here, just after 'orderby' => 'date', add 'order' => 'desc' .

    That should display the most recent related products first.

    Thread Starter luamaralstudio

    (@agpashion)

    Hey Margaret! Thank you so much for the super quick reply.
    Wouldn’t that only affect the order in which the RP are displayed though? What I would like is for the products to be selected to be on the page based on their more recent publishing date. For example, currently I get products from 2020 being displayed as related, when I have many fresh products that should be selected instead.

    I don’t mind the ordering of the RPs on the page.

    Any thoughts?
    Thank you!

    Mirko P.

    (@rainfallnixfig)

    Hi @agpashion

    At the moment, there’s no default option for that in WooCommerce, and customizing that would require a bit of additional coding. Custom coding goes beyond the scope of support we are able to provide in this forum.

    Searching around I found this snippet that will allow you to show related products from a specific product ID, so you can select the most recent product IDs.

    If you require further assistance with the snippet, you could reach out to some of the official WooCommerce development partners via this link: https://woocommerce.com/customizations/.

    Thanks.

    Thread Starter luamaralstudio

    (@agpashion)

    Thank you for the kind answer, Mirko.

    Too bad there’s no solution for this, but the link you sent has some useful options for a temporary fix for my problem.

    I hope WooCommerce will change this asap, I really think the RPs should display the most recent products in each related category by default, which will allow for them to be updated constantly as new products are included. The oldest will always be the oldest, that means the related posts displayed are always the same.

    I hope somebody up there reads this ??
    Again, thank you very much!

    Hi @agpashion

    Thanks for your feedback. We’ll forward your suggestion to our developers so they can take suitable steps.

    Cheers

    Thread Starter luamaralstudio

    (@agpashion)

    Thank you, Margaret!

    If anybody needs this change like me, this plugin, that I found on the link Mirko shared before, allowed me to change the sorting of the RPs the way I wanted. YAY!!

    I was trying to avoid using a plugin, but I needed this so much, I decided to go for it and I’m happy with how it works.

    Cheers!

    That’s awesome! Thanks for letting us know.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Woocommerce related products to display the most recent instead of oldest’ is closed to new replies.