• Resolved gerzar

    (@gerzar)


    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)
Viewing 1 replies (of 1 total)
  • The topic ‘Please, check my code! :)’ is closed to new replies.