How To Display Random Products On Shop Homepage Of Woocommerce?

Discussion in 'General Scripting Chat' started by tommysalami34, Jan 29, 2015.

  1. tommysalami34

    tommysalami34 Newbie

    Joined:
    Dec 19, 2014
    Messages:
    17
    Likes Received:
    4
    I was wondering how to randomize the products on the homepage of our store? I don't want to sort by default, price or by category. I want to have a random display of products on my homepage that is randomized every time a customer visits the homepage.
     
  2. MrBlue

    MrBlue Senior Member

    Joined:
    Dec 18, 2009
    Messages:
    975
    Likes Received:
    682
    Occupation:
    Web/Bot Developer
    This should start you on the right track.
    Code:
    <?php $posts = get_posts('orderby=rand&numberposts=5'); ?>
    
     
  3. Snail White Cream

    Snail White Cream Regular Member

    Joined:
    Jan 19, 2014
    Messages:
    270
    Likes Received:
    35
    what type of theme are you using? Paid or free?
     
  4. tommysalami34

    tommysalami34 Newbie

    Joined:
    Dec 19, 2014
    Messages:
    17
    Likes Received:
    4
    Paid... Pinshop

    I am just unsure where to find the code.