• Resolved Umberto

    (@umberto69)


    Hi, I currently view the products in the woocommerce home in alphabetical order. I wish visitors could see them randomly or the new ones first. In the woocommerce options I can’t find the way to order them as I like. Is there any way to do this?

    Grazie

    • This topic was modified 1 year, 9 months ago by Umberto.

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @umberto69

    Thanks for reaching out!

    I understand that you want to sort your products randomly on your site.

    I did some research and found these articles could be a good starting point:

    Hope this helps!

    Thread Starter Umberto

    (@umberto69)

    Thanks for the valuable information. I’ve used the following code in code snippets, and it works great!

    add_action( 'pre_get_posts', 'shop_default_orderby_rand' );
    function shop_default_orderby_rand( $query ) {
        if ( is_shop() && ( ! isset($_GET['orderby']) || 'menu_order' === $_GET['orderby'] ) ) {
            $query->set( 'orderby', 'rand' );
        }
    }

    Greetings

    Saif

    (@babylon1999)

    Hello @umberto69,

    Thank you for sharing the solution with the community. ??

    I will go ahead and mark the thread as solved for now. Please feel free to open a new one if you have any other questions.

    Cheers!

    Thread Starter Umberto

    (@umberto69)

    HI,
    I noticed that when loading the other pages of the shop, I see products that I have seen in the previous pages and that some products are not displayed. This is because random items are displayed on a single page and not on the whole shop.
    I don’t know how to fix this, do you have any suggestions?
    Thank you

    Hi,

    I see products that I have seen in the previous pages and that some products are not displayed.

    Can you provide a screenshot of the issue on your end, please? You can use https://snipboard.io to send screenshot links in this forum.

    ...?I wish visitors could see them randomly or the new ones first

    To me, that sounds like you would like to display the new arrivals first, one option is to create a new arrivals section:

    Another alternative is to show product badges, one of them could be the new arrival badge, that way your customers will be able to identify the new arrival products better, more info is below:

    I hope this points you in the right direction.

    Thread Starter Umberto

    (@umberto69)

    HI,
    no, i don’t need the product badges and i don’t need the latest uploaded products to be shown.
    I need the products to show randomly. I have tried all the code snippets you provided above. I managed to show them randomly, but only on the single page. When I go to the next page, some of the products shown on the previous page are shown.
    I need visitors to be shown products randomly across the entire pagination.
    For the screenshot see HERE
    I hope I made myself clear.

    Thank you!

    Roxy

    (@roxannestoltz)

    Hi @umberto69 ,

    I’m sorry to hear that none of the above suggestions have produced the results you are looking for here.

    Kindly note that helping with custom code is beyond the scope of this forum, and it may be worth doing a Google search to see if you are able to find any workable solution.

    Alternatively, for help with custom code, you could?hire a developer?or ask your customisation questions in one of the channels below.

    Cheers!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Product display order’ is closed to new replies.