I’m looking for a way to show random WooCommerce products on a page. This is nothing to do with “featured products” just random from any category.
I’ve been looking but cant seem to find any plugin or script to do this? Does anyone have an idea how to do this?
Alright folks here is a bit of code I am using for mine its for recent products but is doing the job. Just add to page you want to show them on.
[recent_products per_page=”4″ columns=”4″ orderby=”rand” order=”rand”]
Try this.
Paste code into functions.php
Go to wp-admin/ Woocommerce > Settings > Products > Display
View settings drop down order by random will be a new option. *note: it will be the the last option.
You can try it. let post it in function.php
This works for me:
This was the code I used [featured_products per_page=”8″ columns=”4″ orderby=”rand”]
I just used this [products limit=”8″ columns=”4″ orderby=”rand” order=”rand” visibility=”visible”].and it works as expected
If you would like to use code to make the shop homepage sort by random, then use the following code. All you need to do is install a plugin called “code snippets” that allows you to make changes in WordPress without changing any core files.