Support » Plugin: Custom Product Tabs for WooCommerce » Tabs ordering

  • Resolved perla77marta


    How to create tabs with random ordering of the navigation elements. I mean for example tabs with Product1, Product2, Product3 and Products4.
    First load Product1, Product2, Product3, Products4
    Second load Product2, Product1, Products4, Product3
    and etc.
    You know what I mean ?

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


    Hi @perla77marta,

    Unfortunately I’m not sure what you mean. What do you mean by navigation elements? Do you have a website you can share a link to that has these navigation elements?

    Do you want your tabs (e.g. Tab1, Tab2, Tab3, Tab4) to be in a random order for each product?

    Let me know.

    Thank you,

    Hello Kevin,

    thank you for your fast reply. Sorry for my bad explanation.
    I wish to see tabs buttons in random ordering after every page load. You know what I mean? Every time when visitor open my wordpress page where tabs published (I’ll have much more tabs then 4), but every time I need to show this content in random order. Is it possible ?

    Thank you!

    Plugin Contributor yikesitskevin


    Hi @perla77marta,

    Yeah, we can do this. Are you familiar with adding custom PHP functions to your site? This custom function will go through every tab you have and give it a random order. (Note it will also randomize the order of the default tabs, like Description, Additional Information, and Reviews, if they’re present).

    add_filter( 'woocommerce_product_tabs', 'yikes_woo_randomize_tab_order', 98, 1 );
    function yikes_woo_randomize_tab_order( $tabs ) {
    	$tab_count = count( $tabs );
    	foreach ( $tabs as $key => $tab ) {
    		$tabs[$key]['priority'] = mt_rand( 0, $tab_count );
    	return $tabs;


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Tabs ordering’ is closed to new replies.