• Resolved martyn

    (@marty2010)


    Hi there,
    I need to have a custom fields in vendor’s product page.
    Using the code below I see the new tab but don’t know where to find this in the product pages (I want to write some text inside, depends on the product features).
    I’d like to solve this without a plugin.
    See imgs url below.
    2 screenshot here:
    https://i.stack.imgur.com/PgGNy.png

    View post on imgur.com


    Thank’s

    // Register the Tab by hooking into the 'woocommerce_product_data_tabs' filter
    add_filter( 'woocommerce_product_tabs', 'add_my_custom_product_data_tab' );
    function add_my_custom_product_data_tab( $product_data_tabs ) {
        $product_data_tabs['my-custom-tab'] = array(
            'label' => __( 'My Custom Tab', 'my_text_domain' ),
            'target' => 'my_custom_product_data',
        );
        return $product_data_tabs;
    }
    
    // tab content hooking into the 'woocommerce_product_data_panels' action hook 
    
    add_action( 'woocommerce_product_data_panels', 'add_my_custom_product_data_fields' );
    function add_mailchimp_product_data_fields() {
        global $woocommerce, $post;
        ?>
        <div id="my_custom_product_data" class="panel woocommerce_options_panel">
            <?php
            woocommerce_wp_checkbox( array( 
                'id'            => '_my_custom_field', 
                'wrapper_class' => 'show_if_simple', 
                'label'         => __( 'My Custom Field Label', 'my_text_domain' ),
                'description'   => __( 'My Custom Field Description', 'my_text_domain' ),
                'default'       => '0',
                'desc_tip'      => false,
            ) );
            ?>
        </div>
        <?php
    }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cannot find custom fields in vendors panel’ is closed to new replies.