SHARE
TWEET

Untitled

a guest Jun 20th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Register the Tab by hooking into the 'woocommerce_product_data_tabs' filter
  2. add_filter( 'woocommerce_product_tabs', 'add_my_custom_product_data_tab' );
  3. function add_my_custom_product_data_tab( $product_data_tabs ) {
  4.     $product_data_tabs['my-custom-tab'] = array(
  5.         'label' => __( 'My Custom Tab', 'my_text_domain' ),
  6.         'target' => 'my_custom_product_data',
  7.     );
  8.     return $product_data_tabs;
  9. }
  10.  
  11. // tab content hooking into the 'woocommerce_product_data_panels' action hook
  12.  
  13. add_action( 'woocommerce_product_data_panels', 'add_my_custom_product_data_fields' );
  14. function add_mailchimp_product_data_fields() {
  15.     global $woocommerce, $post;
  16.     ?>
  17.     <div id="my_custom_product_data" class="panel woocommerce_options_panel">
  18.         <?php
  19.         woocommerce_wp_checkbox( array(
  20.             'id'            => '_my_custom_field',
  21.             'wrapper_class' => 'show_if_simple',
  22.             'label'         => __( 'My Custom Field Label', 'my_text_domain' ),
  23.             'description'   => __( 'My Custom Field Description', 'my_text_domain' ),
  24.             'default'       => '0',
  25.             'desc_tip'      => false,
  26.         ) );
  27.         ?>
  28.     </div>
  29.     <?php
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top