Divi WooCommerce Products Random Sorting: A Complete Guide

If you’re using the Divi theme with WooCommerce, you likely want to show off your awesome products in the best way possible. But what if your store looks the same every time someone visits? That’s where random sorting comes in! Shaking things up keeps your site fresh and exciting.

In this guide, we’ll take a fun and simple look at how to set up random product sorting in Divi + WooCommerce. Let’s dive in!

🎲 Why Random Sorting?

Imagine walking into a store. Every time, the same product is in the front. Would you even notice the others? Probably not.

Random sorting helps you:

  • Give equal attention to all products
  • Highlight new or underperforming items
  • Create a fresh experience for each visitor

Luckily, with Divi and WooCommerce, setting up random sorting isn’t that hard. You just need the right tools or code snippet.

🛠️ Method 1: Use a Shortcode Module

The quickest way to show randomly sorted products is by using a shortcode in a Divi module.

Here’s how:

  1. Edit your page with the Divi Builder.
  2. Add a Text module where you want the products to appear.
  3. Paste this shortcode:
[products orderby="rand" limit="8"]

This tells WooCommerce to pull 8 products and sort them randomly. You can adjust the number to show more or fewer items.

🧩 Method 2: Use the WooCommerce Module (with a trick!)

Divi has a built-in WooCommerce module for products. Sadly, it doesn’t support random sorting out of the box. But you can still make it work with a bit of code magic.

Step 1: Add Custom Code

Add this snippet to your child theme’s functions.php file or a plugin like “Code Snippets.”

add_action( 'pre_get_posts', 'divi_random_sorting_products' );
function divi_random_sorting_products( $query ) {
    if ( ! is_admin() && $query->is_main_query() && is_shop() ) {
        $query->set( 'orderby', 'rand' );
    }
}

This makes the main shop page show products randomly on every load.

Step 2: Customize for Product Grids

If you want this random effect in other WooCommerce product modules, you might need a page-specific tweak using custom loops or filters. But for casual shop owners, the first method (shortcode) might be enough. Easy and clean!

🌟 Pro Tip: Use Custom Layouts with Divi Builder

Want full design control? Combine the random shortcode with the Theme Builder in Divi.

  • Create a custom layout for your shop page.
  • Insert the Text module with your random shortcode.
  • Style it using Divi’s design tools.

This way, your random products look great and match your brand!

⚡ Important Notes

  • Random sorting can impact load time if you’re showing many products at once.
  • It’s not great for SEO when used on main category or archive pages.
  • Use it wisely—consider using on the homepage or featured sections only.

🎉 Final Thoughts

Random product sorting in Divi + WooCommerce can be a fun way to surprise your visitors. Whether you use a shortcode or a bit of custom code, it’s not hard to implement.

Play around and experiment. E-commerce is all about testing what works!

So go ahead—add some randomness, sparkle up your storefront, and let your products shine in new ways every time someone stops by. You’ve got this!

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *