• Righto — so after some searching I ran across a few support threads such as:
    ( http://wordpress.org/support/topic/how-to-rearrange-tabs-viewed-with-woocommerce?replies=6 & http://wordpress.org/support/topic/plugin-woocommerce-excelling-ecommerce-how-to-change-order-of-product-tabs?replies=9 ), each offering the same solution with a custom function. Now this may just be an issue on my server alone, but I tried this function and it seemed to work — but if a product’s tabs were disabled or empty, the tab would still generate on the frontend–just without any text or content. What I ended up having to do was track down the php file that sets the default priority (woocommerce/woocommerce-template.php) and copy/paste that specific function into my functions.php file:

    // ----------------------------------SET ORDER OF PRODUCT TABS
    if ( ! function_exists( 'woocommerce_default_product_tabs' ) ) {
    
    	function woocommerce_default_product_tabs( $tabs = array() ) {
    		global $product, $post;
    
    		// Description tab - shows product content
    		if ( $post->post_content )
    			$tabs['description'] = array(
    				'title'    => __( 'Description', 'woocommerce' ),
    				'priority' => 20,
    				'callback' => 'woocommerce_product_description_tab'
    			);
    
    		// Additional information tab - shows attributes
    		if ( $product->has_attributes() || ( get_option( 'woocommerce_enable_dimension_product_attributes' ) == 'yes' && ( $product->has_dimensions() || $product->has_weight() ) ) )
    			$tabs['additional_information'] = array(
    				'title'    => __( 'Additional Information', 'woocommerce' ),
    				'priority' => 10,
    				'callback' => 'woocommerce_product_additional_information_tab'
    			);
    
    		// Reviews tab - shows comments
    		if ( comments_open() )
    			$tabs['reviews'] = array(
    				'title'    => sprintf( __( 'Reviews (%d)', 'woocommerce' ), get_comments_number( $post->ID ) ),
    				'priority' => 30,
    				'callback' => 'comments_template'
    			);
    
    		return $tabs;
    	}
    }
    // --END-----------------------------SET ORDER OF PRODUCT TABS

    This works perfectly–but it’s rather verbose. So I was wondering if any wonderful admins/authors/users had some insight. Perhaps there’s a more simple function? I’m sure there’s a way to code this more elegantly. But I don’t write much php, I’m just a graphic designer.
    Thoughts?

    (Woo 2.0.9)

    http://wordpress.org/extend/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
    function woo_reorder_tabs( $tabs ) {
    
    	$tabs['reviews']['priority'] = 5;			// Reviews first
    	$tabs['description']['priority'] = 10;			// Description second
    	$tabs['additional_information']['priority'] = 15;	// Additional information third
    
    	return $tabs;
    }

    Could this be your solution?

Viewing 1 replies (of 1 total)
  • The topic ‘Changing the order/priority of single-product tabs (Full-proof?)’ is closed to new replies.