woocommerce_default_product_tabs

Add default product tabs to product pages.

Description

(array) woocommerce_default_product_tabs( (array) $tabs = array() ); 

Returns (array)

Parameters (1)

0. $tabs — Optional. (array) => array()
The tabs.

Usage

  1. if ( !function_exists( 'woocommerce_default_product_tabs' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-template-functions.php'; 
  3.  
  4. // The tabs. 
  5. $tabs = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = woocommerce_default_product_tabs($tabs); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-template-functions.php  
  1. function woocommerce_default_product_tabs( $tabs = array() ) { 
  2. global $product, $post; 
  3.  
  4. // Description tab - shows product content 
  5. if ( $post->post_content ) { 
  6. $tabs['description'] = array( 
  7. 'title' => __( 'Description', woocommerce ),  
  8. 'priority' => 10,  
  9. ); 
  10.  
  11. // Additional information tab - shows attributes 
  12. if ( $product && ( $product->has_attributes() || apply_filters( 'wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions() ) ) ) { 
  13. $tabs['additional_information'] = array( 
  14. 'title' => __( 'Additional information', woocommerce ),  
  15. 'priority' => 20,  
  16. ); 
  17.  
  18. // Reviews tab - shows comments 
  19. if ( comments_open() ) { 
  20. $tabs['reviews'] = array( 
  21. 'title' => sprintf( __( 'Reviews (%d)', woocommerce ), $product->get_review_count() ),  
  22. 'priority' => 30,  
  23. 'callback' => 'comments_template',  
  24. ); 
  25.  
  26. return $tabs;