Title: Please, check my code! :)
Last modified: February 1, 2019

---

# Please, check my code! :)

 *  Resolved [gerzar](https://wordpress.org/support/users/gerzar/)
 * (@gerzar)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/please-check-my-code/)
 * HI! I wrote this code, but for some reason it does not add new tabs under the
   product. Where did I go wrong? THANK you!
 *     ```
       add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
       function woo_new_product_tab( $tabs ) {
         // Adds the new tab
         if(is_product_category('Gift Cards')){
         $tabs['test_tab'] = array(
           'title'     => __( 'Private policy', 'woocommerce' ),
           'priority'  => 50,
           'callback'  => 'woo_new_product_tab_content'
         );
       } elseif (is_product_category('PayPal')){
           $tabs['test_tab'] = array(
           'title'     => __( 'Private policy', 'woocommerce' ),
           'priority'  => 50,
           'callback'  => 'woo_new_product_tab_content2'
         );
       }else (is_product_category('Gift Cards2')){
           $tabs['test_tab'] = array(
           'title'     => __( 'Private policy', 'woocommerce' ),
           'priority'  => 50,
           'callback'  => 'woo_new_product_tab_content3'
       }
         return $tabs;
   
       }
   
       function woo_new_product_tab_content() {
       // text
         echo '<h2></h2>';
         echo '<p>Description</p>';
   
       }
       function woo_new_product_tab_content2() {
       // text
         echo '<h2></h2>';
         echo '<p>Description2</p>';
   
       }
       function woo_new_product_tab_content3() {
       // text
         echo '<h2></h2>';
         echo '<p>Description3</p>';
   
       }
       ```
   

Viewing 1 replies (of 1 total)

 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/please-check-my-code/#post-11157302)
 * In the “Gift Cards2” bit, the array needs a closing ) bracket.
 * You can validate your code here:
    [http://phpcodechecker.com/](http://phpcodechecker.com/)

Viewing 1 replies (of 1 total)

The topic ‘Please, check my code! :)’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [by-category](https://wordpress.org/support/topic-tag/by-category/)

 * 1 reply
 * 2 participants
 * Last reply from: [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/please-check-my-code/#post-11157302)
 * Status: resolved