'Reordering woocommere product tabs is causing the reviews tab to break
I have a few custom tabs made in the functions.php file: description, technologies and specifications. I also use the default reviews tab.
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
unset( $tabs['description'] ); // Removed
unset( $tabs['additional_information'] ); // Removed
$tabs['attrib_desc_tab'] = array(
'title' => __( 'Description', 'woocommerce' ),
'callback' => 'desc_tab'
);
$tabs['specifications'] = array(
'title' => __( 'Specifications', 'woocommerce' ),
'callback' => 'specs_tab'
);
$tabs['techs'] = array(
'title' => __( 'Technologies', 'woocommerce' ),
'callback' => 'tech_tab'
);
return $tabs;
}
I have used the below code to push the reviews tab to the end:
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {
$tabs['attrib_desc_tab']['priority'] = 10;
$tabs['specifications']['priority'] = 20;
$tabs['techs']['priority'] = 30;
$tabs['reviews']['priority'] = 40;
return $tabs;
}
It works, except the reviews tab is now just blank. It should be showing "There are no reviews yet. Be the first to review..." then the review form.
There are no errors in the console. Anyone know what could cause this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
