/**
  * Include script on the post/edit product pages
  *
  * @script( include_in: "admin" )
  */
 public function add_product_scripts()
 {
     $screen = get_current_screen();
     if ($screen->id != 'product') {
         return;
     }
     $ml_product = null;
     if (!empty($_GET['post'])) {
         $ml_product = new ML_Product(intval($_GET['post']));
         if ($ml_product->is_published()) {
             return;
         }
     }
     $textdomain = ML()->textdomain;
     wp_enqueue_script('jquery-option-tree-script', WooCommerce_MercadoLivre::get_plugin_url('/assets/js/jquery.option.tree.js'), array('jquery'));
     wp_enqueue_script('ml-categories-script', WooCommerce_MercadoLivre::get_plugin_url('/assets/js/ml.categories.tree.js'), array('jquery-option-tree-script'), '1.4.1');
     $array_fields = array('url' => add_query_arg(array('action' => 'get_ml_subcategories', 'security' => wp_create_nonce('ml-product-action')), admin_url('admin-ajax.php')), 'check_variation_url' => add_query_arg(array('action' => 'check_variation', 'security' => wp_create_nonce('ml-product-action')), admin_url('admin-ajax.php')), 'get_shipping_modes_url' => add_query_arg(array('action' => 'get_ml_shipping_modes', 'security' => wp_create_nonce('ml-shipping-action')), admin_url('admin-ajax.php')), 'image_url' => WooCommerce_MercadoLivre::get_plugin_url('/assets/img/ajax-loader.gif'), 'first_level_label' => __('Category', $textdomain), 'level_label' => __('Subcategory', $textdomain), 'pre_selected' => isset($ml_product->category_id) ? wp_list_pluck(ML_Category::get_category_path($ml_product->category_id), 'id') : null);
     wp_localize_script('ml-categories-script', 'obj', $array_fields);
 }
 /**
  * Instance shortcut
  */
 function ML()
 {
     return WooCommerce_MercadoLivre::get_instance('WooCommerce_MercadoLivre');
 }
		<?php 
woocommerce_wp_select(array('id' => 'ml_shipping_mode', 'label' => __('Shipping', $textdomain), 'description' => __('Determine how your product will be delivered for buyers on MercadoLivre', $textdomain), 'desc_tip' => true, 'options' => ML()->ml_communication->get_shipping_modes(empty($ml_product->category_id) ? null : $ml_product->category_id), 'value' => isset($_POST['ml_shipping_mode']) ? $_POST['ml_shipping_mode'] : $ml_product->shipping_mode, 'custom_attributes' => $ml_product->can_update_special_fields() ? array() : array('disabled' => 'disabled')));
if (!empty($ml_product->shipping_mode) && $ml_product->shipping_mode != 'not_specified') {
    $category_id = $ml_product->category_id;
    include_once "html-{$ml_product->shipping_mode}-shipment.php";
}
?>
	</div>
	<script type="text/javascript">
		jQuery(document).ready(function($) {
			$('#ml_shipping_mode').change(function() {
				// Remove previous shipping mode content
				$('#ml_shipment_content').remove();
				// append image
				$('.shipment_fields').append('<img src="' + "<?php 
echo WooCommerce_MercadoLivre::get_plugin_url('/assets/img/ajax-loader.gif');
?>
" + '" class="loading_shipment">');
				$.getJSON( "<?php 
echo add_query_arg(array('action' => 'get_ml_shipment', 'security' => wp_create_nonce('ml-shipment-action'), 'product_id' => $thepostid), admin_url('admin-ajax.php'));
?>
" + '&shipping_mode=' + $(this).val() + '&category_id=' + $('#ml_category_id').val() , function( data ) {
					// remove image and insert content
					$('.loading_shipment').remove();
					$('.shipment_fields').append(data);
				});
			});
		});
	</script>
	<div class="options_group">
		<?php 
 /**
  * This function gets the URL to the user authenticate the application in ML.
  *
  * @return string
  **/
 public function get_login_url()
 {
     if (is_null($this->meli)) {
         return '';
     }
     return $this->meli->getAuthUrl(WooCommerce_MercadoLivre::get_admin_settings_page_url());
 }