WordPress.org

Forums

WooCommerce - excelling eCommerce
[resolved] Woocommerce rename product tabs with category as condition (3 posts)

  1. hyperV
    Member
    Posted 1 year ago #

    Hi all,

    Try to rename product tabs with category as condition.
    I get only the result of the else clause. What I need to do toe get it work?
    I use following code:

    /* Rename Tabs */
    
      add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
      function woo_rename_tabs( $tabs ) {
    
    			if ( is_product_category( 'Mixer' ) ) {
    
    					$tabs['additional_information']['title'] = __( 'Technische Daten' );
              $tabs['description']['title'] = __( 'Produktbeschreibung' );
    
    			return $tabs;
    
    		} else {
    
    					$tabs['additional_information']['title'] = __( 'Produktdaten' );
              $tabs['description']['title'] = __( 'Produktbeschreibung' );
    
    			return $tabs;
    	}
    }

    https://wordpress.org/plugins/woocommerce/

  2. hyperV
    Member
    Posted 1 year ago #

    found a solution, I missed the right if clause. This code snipplet works:

    /* Rename Tabs conditional */
    
      add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
      function woo_rename_tabs( $tabs ) {
    
    			if ( is_product() && has_term( 'hochleistungsmixer', 'product_cat' ) ) {
    
    					$tabs['additional_information']['title'] = 'Technische Daten';
              $tabs['description']['title'] = 'Produktbeschreibung';
     return $tabs;
    		}
        else {
    
    					$tabs['additional_information']['title'] = 'Produktdaten';
              $tabs['description']['title'] = 'Produktbeschreibung';
    return $tabs;
    	}
    
    }
  3. hyperV
    Member
    Posted 1 year ago #

    resolved

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic