I am looking for a way to add texarea custom input for woocommerce general tab.
I already try woocommerce_wp_text_input but it shows one line input. Is there any way to add multiple
line input under the general tab?
I am looking for a way to add texarea custom input for woocommerce general tab.
I already try woocommerce_wp_text_input but it shows one line input. Is there any way to add multiple
line input under the general tab?
Just use woocommerce_wp_textarea_input opposite woocommerce_wp_text_input
So you get:
// Add field
function action_woocommerce_product_options_general_product_data() {
// Textarea Field
woocommerce_wp_textarea_input( array(
'id' => '_my_field_id',
'label' => __( 'My label', 'woocommerce' ),
'desc_tip' => true,
'description' => __( 'Some description', 'woocommerce' ),
));
}
add_action( 'woocommerce_product_options_general_product_data', 'action_woocommerce_product_options_general_product_data', 10, 0 );
// Save Field
function action_woocommerce_admin_process_product_object( $product ) {
if( isset( $_POST['_my_field_id'] ) ) {
$product->update_meta_data( '_my_field_id', esc_html( $_POST['_my_field_id'] ) );
}
}
add_action( 'woocommerce_admin_process_product_object', 'action_woocommerce_admin_process_product_object', 10, 1 );
Simply use the existing woocommerce_wp_textarea_input() function instead.
Related treads with woocommerce_wp_textarea_input() function.