Web Dev Tuts

/ Stuffs About Website Development /

Menu
  • Home
  • Wp Plugins
  • How To
  • FAQ
    • GIT
    • JQuery
    • PHP
    • WooCommerce
    • WordPress
  • Contact Us
Menu

Add Custom Admin Option For WooCommerce Products

Posted on July 31, 2016September 24, 2017 by admin
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 '';
}
Category: Wordpress

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • How to add wp_editor Dynamically
  • How to Hide Certain Pages from Certain Users (WP Dashboard)
  • How to Set Up Gmail SMTP
  • How to Set Up Virtual Host in Localhost & Xampp
  • How to Determine the Current WordPress Version Used
  • AngularJs
  • CSS
  • For Me Only
  • geo location api
  • GIT
  • GoDaddy
  • Hosting
  • How To
  • Javascript
  • JQuery
  • Magento
  • My Notes
  • PHP
  • Private
  • Sass
  • WooCommerce
  • Wordpress
  • Xampp
© 2023 Web Dev Tuts | Powered by Minimalist Blog WordPress Theme