• Resolved MarkJ

    (@forusak)


    When I limit the products shortcode to 4 products, it repeats only few sets of products, maybe 16, and it never displays the other ones.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Rodrigo Primo

    (@rodrigosprimo)

    Hi @forusak,

    The list of products displayed by the [products] shortcode is cached for performance reasons. When orderby=rand is used, a few sets of randomly generated products are cached and then, on each page load, WooCommerce randomly chooses from one of the sets.

    By default, WooCommerce caches six different sets of products. You can use the filter woocommerce_product_query_max_rand_cache_count to change this number.

    Thread Starter MarkJ

    (@forusak)

    Hi Rodrigo,

    I see, thank you 🙂
    I wonder, how often is this cached cleared? So it shows a different set.

    • This reply was modified 5 years, 6 months ago by MarkJ.
    Thread Starter MarkJ

    (@forusak)

    @rodrigosprimo hi, can I get the answer for that question above please? thank you 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Shortcode for random products not working as expected’ is closed to new replies.