Home Forums WoodMart support forum Use brand name for tab title does not translate Reply To: Use brand name for tab title does not translate

#36502

Artem Temos
Keymaster

Sorry, seems to be a small issue in the code. Try to add the following PHP code snippet to the child theme functions.php file to fix this

function woodmart_product_brand_tab( $tabs ) {
	global $product;
	
	$show_tab = false;
	$brand_title = 'brand';
	$brand_info = wc_get_product_terms( $product->get_id(), woodmart_get_opt( 'brands_attribute' ), array( 'fields' => 'all' ) );
	if ( !isset( $brand_info[0] ) ) return $tabs;
	
	if ( $brand_info[0]->description ) $show_tab = true;
	if ( woodmart_get_opt( 'brand_tab_name' ) ) $brand_title = $brand_info[0]->name;
	
	if ( $show_tab ) {
		$tabs['brand_tab'] = array(
			'title' 	=> sprintf( esc_html__( 'About %s', 'woodmart' ), $brand_title ),
			'priority' 	=> 50,
			'callback' 	=> 'woodmart_product_brand_tab_content'
		);
	}

	return $tabs;
}