add_action('woocommerce_product_options_general_product_data', array($this, 'wooAddCustomGeneralFields'));
add_action('woocommerce_process_product_meta', array($this, 'wooAddCustomGeneralFieldsSave'));

function wooAddCustomGeneralFields() {
	global $woocommerce, $post;
	echo '';
	// Text Field
	woocommerce_wp_text_input(
		array(
			'id' => '_deal_deadline',
			'label' => 'Deal Deadline',
			'placeholder' => '',
			'desc_tip' => 'true',
		)
	);

	// Text Field
	woocommerce_wp_text_input(
		array(
			'id' => '_deal_min',
			'label' => 'Mininum Order',
			'placeholder' => '',
			'desc_tip' => 'true',
		)
	);

	// Text Field
	woocommerce_wp_text_input(
		array(
			'id' => '_deal_max',
			'label' => 'Maximum Order',
			'placeholder' => '',
			'desc_tip' => 'true',
		)
	);

	$units_sold = get_post_meta( $post->ID, 'total_sales', true );
	
	woocommerce_wp_text_input(
		array(
			'id' => 'total_sales',
			'label' => 'Total Sales',
			'placeholder' => '',
			'desc_tip' => 'true',
			'value' => $units_sold,
			'description' => 'Changing this value may affect how woocommerce work. Just change it when really needed!'
		)
	);

	echo '';
}

Leave a Reply