woocommerce - Add custom field woocomerce (variable product) -


i search how can add custom field viriable product in woocomerce. allready this, work simple product.

add_action( 'woocommerce_product_options_general_product_data', 'wc_custom_add_custom_fields' ); function wc_custom_add_custom_fields() {     // print custom text field     woocommerce_wp_text_input( array(         'id' => '_custom_text_field',         'label' => 'custom text field',         'description' => 'this custom field, can write here want.',         'desc_tip' => 'true',         'placeholder' => 'custom text'     ) ); } add_action( 'woocommerce_process_product_meta', 'wc_custom_save_custom_fields' ); function wc_custom_save_custom_fields( $post_id ) {     if ( ! empty( $_post['_custom_text_field'] ) ) {         update_post_meta( $post_id, '_custom_text_field', esc_attr( $_post['_custom_text_field'] ) );     } } 

how can edit have variable product ? thanks

just change

add_action( 'woocommerce_product_options_general_product_data', 'wc_custom_add_custom_fields' ); 

to

add_action( 'woocommerce_product_options_inventory_product_data', 'wc_custom_add_custom_fields' ); 

and custom field in inventory tab


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -