Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Custom field for price labels
- // Display Fields
- add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
- // Save Fields
- add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' );
- function woo_add_custom_general_fields() {
- global $woocommerce, $post;
- // Textarea
- woocommerce_wp_textarea_input(
- array(
- 'id' => '_textarea',
- 'label' => __( 'My Textarea', 'woocommerce' ),
- 'placeholder' => '',
- 'description' => __( 'Enter the custom value here.', 'woocommerce' )
- )
- );
- // Textarea
- $woocommerce_textarea = $_POST['_textarea'];
- if( !empty( $woocommerce_textarea ) )
- update_post_meta( $post_id, '_textarea', esc_html( $woocommerce_textarea ) );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement