• Resolved sjoerd89

    (@sjoerd89)


    Hi,

    i am trying to rename my product data tabs but somehow 1 changes perfectly and the other just does not. I have this in my functions.php file in my child theme and somehow the description tab will not change.

    <?php //
    
    add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
    function woo_reorder_tabs( $tabs ) {
    
    	$tabs['additional_information']['priority'] = 5;	// Additional information first
    	$tabs['description']['priority'] = 10;			// Description second
    
    	return $tabs;
    }
    
    add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
    function woo_rename_tabs( $tabs ) {
    
    	$tabs['description']['title'] = __( 'randomtitlehere' );		// Rename the description tab
    	$tabs['additional_information']['title'] = __( 'kersentaart' );	// Rename the additional information tab
    
    	return $tabs;
    }

    What am i doing wrong here?

    Thanks all,

    Sjoerd

    https://www.ads-software.com/plugins/woocommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Your code is working on my site: https://cld.wthms.co/1jIyB/1FcvqBbP

    Must have something else hooking in later and changing it back. Trying increasing the priority level to something even higher than 98.

    Thread Starter sjoerd89

    (@sjoerd89)

    I have checked if there was anything that could hook it somewhere and it shouldn’t. I have also tried to change the priority of the renaming.

    <?php //
    
    add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 100 );
    function woo_rename_tabs( $tabs ) {
    
    	$tabs['additional_information']['title'] = __( 'Gegevens' );	// Rename the additional information tab
    	$tabs['description']['title'] = __( 'Extra informatie' ); 	// Rename the description tab
    	return $tabs;
    }
    
    add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
    function woo_reorder_tabs( $tabs ) {
    
    	$tabs['additional_information']['priority'] = 5;	// Additional information first
    	$tabs['description']['priority'] = 10;			// Description second
    
    	return $tabs;
    }

    Somehow my page now just says ‘Gegevens’ twice on the tabs. I have tried to change the priority a couple of times even to the extreme of a 1000, but yet again no result.

    I have my website in a codepen because it is not online at the moment.
    https://codepen.io/Sjoerd89/pen/pbmbJa

    Thanks for your time,

    Sjoerd

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Not sure what you are doing wrong to be honest. The code is working fine for me. Try disabling all other plugins and switching to a default theme to see if that helps and rule out the possibility of another plugin/theme interferring.

    Otherwise, maybe you should use this plugin instead of going the custom code route: https://woocommerce.com/products/woocommerce-tab-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Renaming a product data tab’ is closed to new replies.