fbpx
-50% OFF Black Friday coupon: BF2021

Custom Tabs order

HomeTopicsSupport forumCustom Tabs order
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #17006
    Avatar
    spletster
    Participant

    Hi

    I would like to reorder tabs on product page.
    There are two custom tabs, one as additional Tab added on Theme settings page and another one related to the product (added as Additional Tab under product Meta boxes).
    First one is General, second one is displayed for specific product only.

    So I would like to display tab in following order:
    – Default tabs
    – Product specefic tab(s)
    – Theme additional tab(s)

    I have been searching for Woodomart, but snippet does not work, as “wd_custom_tab” probably means Woodmart.
    Snippet
    function reordered_tabs( $tabs ) {
    $tabs[‘wd_custom_tab’][‘priority’] = 6;
    $tabs[‘description’][‘priority’] = 5;
    $tabs[‘reviews’][‘priority’] = 15;
    return $tabs;
    }
    add_filter( ‘woocommerce_product_tabs’, ‘reordered_tabs’, 98 );

    Also, if you can provide a snippet, please add also one for changing order of Deafult woo tabs.

    Thanks.

    #17007
    Artem Temos
    Artem Temos
    Keymaster

    Hello,

    Try to apply the following code snippet

    if ( ! function_exists( 'xts_reordered_tabs' ) ) {
    	function xts_reordered_tabs( $tabs ) {
    		if ( isset( $tabs['xts_additional_tab'] ) ) {
    			$tabs['xts_additional_tab']['priority'] = 90;
    		}
    
    		if ( isset( $tabs['xts_additional_tab_2'] ) ) {
    			$tabs['xts_additional_tab_2']['priority'] = 100;
    		}
    
    		if ( isset( $tabs['xts_additional_tab_3'] ) ) {
    			$tabs['xts_additional_tab_3']['priority'] = 110;
    		}
    
    		return $tabs;
    	}
    
    	add_filter( 'woocommerce_product_tabs', 'xts_reordered_tabs', 98 );
    }

    Kind Regards

    #17008
    Avatar
    spletster
    Participant

    Thanks.
    It works 🙂

    Ragards

    #17009
    Artem Temos
    Artem Temos
    Keymaster

    You are welcome!

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Custom Tabs order’ is closed to new replies.

Sign in

No account yet?

Create an Account