skip to Main Content

I can get array keys of product data tabs in woo product editor page by this code var_dump( array_keys( $tabs ) );, so I can hide them. But I could not solve the array keys of couple tabs that created by plugin and build in tab by the theme (flatsome). Any help really appreciate it. Thank you.

add_filter('woocommerce_product_data_tabs' , 'block_wc_product_tabs' );

function block_wc_product_tabs($tabs) {

      if (!current_user_can('yith_vendor')) {  // replace role ID with your own
          return $tabs;
      }

      var_dump( array_keys( $tabs ) );
      //unset($tabs['general']);
      //unset($tabs['inventory']);
      unset($tabs['linked_product']);
      unset( $tabs['tm_extra_product_options'] );
      //unset( $tabs['product_origin'] );

      return $tabs;
    }

2

Answers


  1. Chosen as BEST ANSWER

    below the code used by the plugin to add the tab in product data tabs

    function epeken_product_write_panel_tab() {
                    echo "<li class="product_tabs_lite_tab"><a href="#woocommerce_product_tabs_lite">" . __( 'Epeken Product Config', 'woocommerce' ) . "</a></li>";
            }
    
            function epeken_product_write_panel() {
            global $post;
            if(epeken_is_multi_vendor_mode()) {
                //do nothing if multi vendor mode is true
                ?>
                <div id="woocommerce_product_tabs_lite" class="panel wc-metaboxes-wrapper woocommerce_options_panel" style="padding: 10px;">
                            <table>
                    <tr><td>
                <p>Toko Online Anda berkonsep marketplace. Untuk menerapkan konsep marketplace, pastikan license Anda dilengkapi opsi multi origin. Anda dapat melakukan setting kota asal di level vendor/seller/pelapak sehingga produk ini dapat mengikuti kota asal vendornya. <a href="http://blog.epeken.com/plugin-epeken-support-plugin-marketplace/" target="_blank">Selengkapnya</a></p>
                    </td></tr></table>
                </div>
                <?php
                return;
            }
            $epeken_product_config = array (
                "product_origin" => get_post_meta($post->ID,'product_origin',true)
            );
    

  2. Try increasing the order of execution of your action.

    add_filter('woocommerce_product_data_tabs' , 'block_wc_product_tabs', 9999  );
    
    function block_wc_product_tabs($tabs) {
    
          if (!current_user_can('yith_vendor')) {  // replace role ID with your own
              return $tabs;
          }
    
          var_dump( array_keys( $tabs ) );
          //unset($tabs['general']);
          //unset($tabs['inventory']);
          unset($tabs['linked_product']);
          unset( $tabs['tm_extra_product_options'] );
          //unset( $tabs['product_origin'] );
    
          return $tabs;
        }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search