• Resolved Mark

    (@cybertech537)


    I have imported the WooCommerce demo product.
    Custom field is showing in “WordPress Pennant” product but not others and the other post interfaces are different, I don’t know why.

    
    // Display Fields
    add_action('woocommerce_product_options_general_product_data', 'woocommerce_product_custom_fields');
    // Save Fields
    add_action('woocommerce_process_product_meta', 'product_condition_field_save');
    function woocommerce_product_custom_fields()
    {
        global $woocommerce, $post;
        echo '<div class="product_custom_field">';
        // Custom Product Text Field
        woocommerce_wp_text_input(
            array(
                'id' => '_product_condition',
                'placeholder' => esc_html__('Good, Very Good, Excellent', 'huddlefc'),
                'label' => __('Product Condition', 'huddlefc'),
                'desc_tip' => 'true'
            )
        );
        echo '</div>';
    
    }
    // save field data
    function product_condition_field_save($post_id){
        // Custom Product Text Field
        $product_condition = $_POST['_product_condition'];
        if (!empty($product_condition)){
            update_post_meta($post_id, '_product_condition', esc_attr($product_condition));
        }
    }
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello Mark,

    Thank you for reaching out to WooCommerce support regarding the issue you’re encountering with the visibility of custom fields under the General tab.

    To gain a better understanding of what you’re experiencing, it would be helpful if you could share some screenshots displaying the General tab and post interfaces of the products where the custom field is not appearing.

    Additionally, it’s important to point out that if these custom fields are generated through custom code or a third-party plugin, our ability to provide support might be limited. Our Support Policy does not cover custom code troubleshooting, although we do our best to guide you in the right direction.

    Looking forward to your response. ??

    Best regards.

    Thread Starter Mark

    (@cybertech537)

    https://prnt.sc/lNCaeNhajkhr
    This one shows the field.

    https://prnt.sc/FEa_vahopLwD
    But this one does not.

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @cybertech537,

    It looks like you are using the “New product editor”. Could you please go to WooCommerce > Settings > Advanced > Features, disable the New product editor, and see whether the issues get resolved?

    Let us know how that goes. Looking forward to hearing from you!

    Thread Starter Mark

    (@cybertech537)

    You are right, I was using new product editor(beta version).
    I unchecked this option now the custom field shows up but what else if I want to add field to new product editor(beta)?
    Thanks.

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @cybertech537,

    Adding custom fields to the New Product Editor (beta version) is a bit more complex as it’s still in the development phase. However, you can try using the woocommerce_product_data_panels action hook in your custom code.

    If you still need assistance, we recommend asking development questions on the #developers channel of the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. You can also seek help from the following:

    I wish I could help more, but hopefully, this gets you going in the right direction to get the job done.

    krazyplugins

    (@krazyplugins)

    Hello @cybertech537,

    You can use this plugin to add custom fields to product tabs:
    https://krazyplugins.com/product/acf-for-woocommerce-panels/

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom Field is not showing under General Tab’ is closed to new replies.