admin管理员组

文章数量:1323714

I found and implemented the following code. I need the Additional Information to display BEFORE the Product Description content. I have been looking through posts for hours with no luck.

add_filter( 'woocommerce_product_tabs', function( $tabs ) {
unset( $tabs['additional_information'] );
return $tabs;
}, 98 );

add_filter( 'woocommerce_product_tabs', function( $tabs ) {
$tabs['description']['callback'] = function() {
    global $product;
    wc_get_template( 'single-product/tabs/description.php' );
    if ( $product && ( $product->has_attributes() || apply_filters(
'wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions() ) ) ) 
        wc_get_template( 'single-product/tabs/additional-information.php' );
    }
};
return $tabs;
}, 98 );

I found and implemented the following code. I need the Additional Information to display BEFORE the Product Description content. I have been looking through posts for hours with no luck.

add_filter( 'woocommerce_product_tabs', function( $tabs ) {
unset( $tabs['additional_information'] );
return $tabs;
}, 98 );

add_filter( 'woocommerce_product_tabs', function( $tabs ) {
$tabs['description']['callback'] = function() {
    global $product;
    wc_get_template( 'single-product/tabs/description.php' );
    if ( $product && ( $product->has_attributes() || apply_filters(
'wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions() ) ) ) 
        wc_get_template( 'single-product/tabs/additional-information.php' );
    }
};
return $tabs;
}, 98 );
Share Improve this question asked Sep 9, 2020 at 17:15 user3096199user3096199 211 silver badge3 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Literally just swap the order of them in the code:

add_filter( 'woocommerce_product_tabs', function( $tabs ) {
$tabs['description']['callback'] = function() {
    global $product;
    if ( $product && ( $product->has_attributes() || apply_filters(
'wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions() ) ) ) 
        wc_get_template( 'single-product/tabs/additional-information.php' );
    }
    wc_get_template( 'single-product/tabs/description.php' );
};
return $tabs;
}, 98 );

本文标签: woocommerce offtopicChange order of combined product tabs