Agregar pestaña de configuración personalizada para productos simples en Woocommerce

Tengo un problema al intentar agregar un campo personalizado llamado Discount_info a un producto simple.

He creado una nueva pestaña llamada discount_info que se muestra muy bien en la vista simple del producto. El problema es intentar agregar un campo de número personalizado a esta pestaña. Estoy usando el siguiente código que está causando un error 500. ¿Alguna idea de dónde voy mal?

// Display Fields using WooCommerce Action Hook
add_action( 'woocommerce_product_options_discount_info', 
'woocom_general_product_data_custom_field' );

function woocom_general_product_data_custom_field() {
// Create a custom text field


// Number Field
woocommerce_wp_text_input( 
array( 
  'id' => '_discount_info', 
  'label' => __( 'Discount %', 'woocommerce' ), 
  'placeholder' => '', 
  'description' => __( 'Enter the % discount here.', 'woocommerce' ),
  'type' => 'number', 
  'custom_attributes' => array(
     'step' => 'any',
     'min' => '1'
  ) 
  )
);

}

 // Hook to save the data value from the custom fields
 add_action( 'woocommerce_process_product_meta', 
 'woocom_save_general_proddata_custom_field' );

 /** Hook callback function to save custom fields information */
  function woocom_save_general_proddata_custom_field( $post_id ) {

// Save Number Field
 $number_field = $_POST['_discount_info'];
 if( ! empty( $number_field ) ) {
  update_post_meta( $post_id, '_discount_info', esc_attr( $number_field ) );
  }

 }

Respuestas a la pregunta(2)

Su respuesta a la pregunta