/**
     * Add pre-orders options to product writepanel
     *
     * @since 1.0
     */
    public function add_product_tab_options()
    {
        global $post, $woocommerce;
        ?>
	<div id="wc_pre_orders_data" class="panel woocommerce_options_panel">
		<div class="options_group">
			<?php 
        if ($has_active_pre_orders = WC_Pre_Orders_Product::product_has_active_pre_orders($post->ID)) {
            echo "<p><strong>" . sprintf(__('There are active pre-orders for this product. To change these settings, please %scomplete or cancel the active pre-orders%s first.', WC_Pre_Orders::TEXT_DOMAIN), '<a href="' . admin_url('admin.php?page=wc_pre_orders') . '">', '</a>') . "</strong></p>";
        }
        do_action('wc_pre_orders_product_options_start');
        // enable pre-orders
        woocommerce_wp_checkbox(array('id' => '_wc_pre_orders_enabled', 'label' => __('Enable Pre-Orders', WC_Pre_Orders::TEXT_DOMAIN), 'description' => __('Enable pre-orders for this product. For variable products, pre-orders are enabled for each variation.', WC_Pre_Orders::TEXT_DOMAIN)));
        // availability date/time
        $availability_timestamp = WC_Pre_Orders_Product::get_localized_availability_datetime_timestamp($post->ID);
        ?>
<p class="form-field _wc_pre_orders_availability_datetime_field ">
				<label for="_wc_pre_orders_availability_datetime"><?php 
        _e('Availability Date/Time', WC_Pre_Orders::TEXT_DOMAIN);
        ?>
</label>
				<input type="text" class="short" name="_wc_pre_orders_availability_datetime" id="_wc_pre_orders_availability_datetime" value="<?php 
        echo esc_attr(0 === $availability_timestamp ? '' : date('Y-m-d H:i', $availability_timestamp));
        ?>
" placeholder="YYYY-MM-DD HH:MM"  />
				<img class="help_tip" data-tip="<?php 
        printf(__('Set the date %s time that this pre-order will be available. The product will behave as a normal product when this date/time is reached.', WC_Pre_Orders::TEXT_DOMAIN), '&amp;');
        ?>
" src="<?php 
        echo esc_url($woocommerce->plugin_url() . '/assets/images/help.png');
        ?>
" height="16" width="16" />
			</p>
			<?php 
        // pre-order fee
        woocommerce_wp_text_input(array('id' => '_wc_pre_orders_fee', 'label' => __('Pre-Order Fee', WC_Pre_Orders::TEXT_DOMAIN), 'description' => __('Set a fee to be charged when a pre-order is placed. Leave blank to not charge a pre-order fee.', WC_Pre_Orders::TEXT_DOMAIN), 'desc_tip' => true));
        woocommerce_wp_select(array('id' => '_wc_pre_orders_when_to_charge', 'label' => __('When to Charge', WC_Pre_Orders::TEXT_DOMAIN), 'description' => __('Select "Upon Release" to charge the entire pre-order amount (the product price + pre-order fee if applicable) when the pre-order becomes available. Select "Upfront" to charge the pre-order amount during the initial checkout.', WC_Pre_Orders::TEXT_DOMAIN), 'desc_tip' => true, 'default' => 'upon_release', 'options' => array('upon_release' => __('Upon Release', WC_Pre_Orders::TEXT_DOMAIN), 'upfront' => __('Upfront', WC_Pre_Orders::TEXT_DOMAIN))));
        do_action('wc_pre_orders_product_options_end');
        ?>
		</div>
		<?php 
        // disable fields if the product has active pre-orders
        if ($has_active_pre_orders) {
            ob_start();
            ?>
				$('input[name^=_wc_pre_orders_], select#_wc_pre_orders_when_to_charge').attr('disabled', true);
				$('img.ui-datepicker-trigger').css('display','none');
			<?php 
            $woocommerce->add_inline_js(ob_get_clean());
        }
        ?>
	</div>
	<?php 
    }