woocommerce_default_product_tabs()
Add default product tabs to product pages.
Hooks from the function
Returns
Array.
Usage
woocommerce_default_product_tabs( $tabs );
- $tabs(array)
- Array of tabs.
Default:array()
woocommerce_default_product_tabs() woocommerce default product tabs code WC 10.6.2
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' => 10,
'callback' => 'woocommerce_product_description_tab',
);
}
if ( ! ( $product instanceof WC_Product ) ) {
return $tabs;
}
// Additional information tab - shows attributes.
/**
* Filter to customize the display of dimensions for a product in its product page.
*
* @param bool $enable_dimensions_display True to enable dimensions display for the product.
*
* @since 2.0.14
*/
if ( $product->has_attributes() || apply_filters( 'wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions() ) ) {
$tabs['additional_information'] = array(
'title' => __( 'Additional information', 'woocommerce' ),
'priority' => 20,
'callback' => 'woocommerce_product_additional_information_tab',
);
}
// Reviews tab - shows comments.
if ( comments_open() ) {
$tabs['reviews'] = array(
/* translators: %s: reviews count */
'title' => sprintf( __( 'Reviews (%d)', 'woocommerce' ), $product->get_review_count() ),
'priority' => 30,
'callback' => 'comments_template',
);
}
return $tabs;
}