• Resolved bruceandmrgiggles

    (@bruceandmrgiggles)


    I’m trying to place the chart tab on second, but I don’t know what to put for the chart tab on this snippet:

    function reorder_chart_tab( $tabs ) {
        $tabs['description']['priority'] = 5;
        $tabs['']['priority'] = 10; // for the size chart
        $tabs['additional_information']['priority'] = 15;
        $tabs['reviews']['priority'] = 20;
        
        return $tabs;
    }
    add_filter( 'woocommerce_product_tabs', 'reorder_chart_tab', 98 );
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi there,

    the tab id is

    yith-wcpsc-tag-xxx where XXX is the tab id. By default the priority is set to 99

    Thread Starter bruceandmrgiggles

    (@bruceandmrgiggles)

    Is there a global tab id for the chart tabs so I can reorder all of them at once? Or if there’s a possible way to call the current chart tab id into the snippet?

    Plugin Author YITHEMES

    (@yithemes)

    Hi,

    you can easily achieve your goal by replacing your code snippet with the following one:

    function reorder_chart_tab( $tabs ) {
    	$tabs['description']['priority']            = 5;
    	$tabs['additional_information']['priority'] = 15;
    	$tabs['reviews']['priority']                = 20;
    
    	foreach ( $tabs as $id => $tab ) {
    		if ( strpos( $id, 'yith-wcpsc-tab-' ) === 0 ) {
    			$tabs[ $id ]['priority'] = 10; // for the size chart
    		}
    	}
    
    	return $tabs;
    }
    
    add_filter( 'woocommerce_product_tabs', 'reorder_chart_tab', 98 );

    Please try this solution and let us know if everything works fine! ??

    Thread Starter bruceandmrgiggles

    (@bruceandmrgiggles)

    Thanks, it’s really helpful!

    Plugin Author YITHEMES

    (@yithemes)

    Hi there,
    you’re welcome ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Reordering chart tab’ is closed to new replies.