• Resolved xhat

    (@xhat)


    The goal to achieve is to add a subtitle below the product on the archive product page. But to do so I need to add a custom fied which will save the subtitle value.

        // Display Fields
        add_action('woocommerce_product_options_general_product_data', 'woocommerce_product_custom_fields');
        // Save Fields
        add_action('woocommerce_process_product_meta', 'woocommerce_product_custom_fields_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' => '_custom_field_subtitle',
                    'placeholder' => 'Subtitle',
                    'label' => __('Subtitle Custom Field', 'woocommerce'),
                    'desc_tip' => 'true'
                )
            );
            echo '</div>';
        }

    The code shown above isn’t complete but that’s not what’s important.

    I noticed that the custom field will show for each product variation, and I do not want that.
    I’m looking for it to be generic, for the entire product. Therefore I’d like to place the custom field input below the Product Title on the Product Edit admin page.

    Is that even possible? Since I don’t think it’s related to WooCommerce anymore, but rather the WordPress page.

    Thanks for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi @xhat,

    Thanks for reaching out to us.

    This is a more development-oriented question. I’ll go ahead and leave this thread open for a while in case anyone else wants to chime in, but in the meantime, I can also recommend the following resources for help:

    Cheers.

    Mirko P.

    (@rainfallnixfig)

    Hi there,

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution and the above resources for developers were helpful. If you have further questions, please feel free to open a new topic.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add a custom field on WooCommerce Edit Product Page Below Product Title’ is closed to new replies.