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.