function front_scripts()
        {
            global $woocommerce, $post;
            $page_ids = array(woocommerce_get_page_id('account_addresses'), woocommerce_get_page_id('multiple_addresses'), woocommerce_get_page_id('myaccount'), woocommerce_get_page_id('checkout'), woocommerce_get_page_id('cart'));
            if ($post && !in_array($post->ID, $page_ids)) {
                return;
            }
            $user = wp_get_current_user();
            wp_enqueue_script('jquery', null);
            wp_enqueue_script('jquery-ui-core', null, array('jquery'));
            wp_enqueue_script('jquery-ui-mouse', null, array('jquery-ui-core'));
            wp_enqueue_script('jquery-ui-draggable', null, array('jquery-ui-core'));
            wp_enqueue_script('jquery-ui-droppable', null, array('jquery-ui-core'));
            wp_enqueue_script('jquery-ui-datepicker', null, array('jquery-ui-core'));
            wp_enqueue_script('jquery-masonry', null, array('jquery-ui-core'));
            wp_enqueue_script('thickbox');
            wp_enqueue_style('thickbox');
            wp_enqueue_script('jquery-blockui');
            // touchpunch to support mobile browsers
            wp_enqueue_script('jquery-ui-touch-punch', plugins_url('js/jquery.ui.touch-punch.min.js', __FILE__), array('jquery-ui-mouse', 'jquery-ui-widget'));
            if ($user->ID != 0) {
                wp_enqueue_script('multiple_shipping_script', plugins_url('js/front.js', __FILE__));
                wp_localize_script('multiple_shipping_script', 'WC_Shipping', array('ajaxurl' => admin_url('admin-ajax.php')));
                $page_id = woocommerce_get_page_id('account_addresses');
                $url = get_permalink($page_id);
                $url = add_query_arg('height', '400', add_query_arg('width', '400', add_query_arg('addressbook', '1', $url)));
                ?>
                <script type="text/javascript">
                var address = null;
                var wc_ship_url = '<?php 
                echo $url;
                ?>
';
                </script>
                <?php 
            }
            wp_enqueue_script('jquery-tiptip', plugins_url('js/jquery.tiptip.js', __FILE__), array('jquery', 'jquery-ui-core'));
            wp_enqueue_script('modernizr', plugins_url('js/modernizr.js', __FILE__));
            wp_enqueue_script('multiple_shipping_checkout', plugins_url('js/woocommerce-checkout.js', __FILE__), array('woocommerce', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-mouse'));
            if (function_exists('wc_add_notice')) {
                wp_localize_script('multiple_shipping_checkout', 'WCMS', apply_filters('wc_ms_multiple_shipping_checkout_locale', array('ajaxurl' => admin_url('admin-ajax.php'), 'base_url' => plugins_url('', __FILE__), 'wc_url' => $woocommerce->plugin_url(), 'countries' => json_encode(array_merge($woocommerce->countries->get_allowed_country_states(), $woocommerce->countries->get_shipping_country_states())), 'select_state_text' => esc_attr__('Select an option&hellip;', 'woocommerce'))));
                if (WC_MS_Compatibility::is_wc_version_gte('2.3')) {
                    wp_enqueue_script('select2', '//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js', array('jquery'), '3.5.2');
                    wp_enqueue_style('select2', '//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.css', array(), '3.5.2');
                }
                wp_register_script('wcms-country-select', plugins_url() . '/woocommerce-shipping-multiple-addresses/js/country-select.js', array('jquery'), WC_VERSION, true);
                wp_localize_script('wcms-country-select', 'wcms_country_select_params', apply_filters('wc_country_select_params', array('countries' => json_encode(array_merge(WC()->countries->get_allowed_country_states(), WC()->countries->get_shipping_country_states())), 'i18n_select_state_text' => esc_attr__('Select an option&hellip;', 'woocommerce'))));
                wp_enqueue_script('wcms-country-select');
            } else {
                wp_localize_script('multiple_shipping_checkout', 'WCMS', array('ajaxurl' => admin_url('admin-ajax.php'), 'base_url' => plugins_url('', __FILE__), 'wc_url' => $woocommerce->plugin_url(), 'countries' => json_encode($woocommerce->countries->get_allowed_country_states()), 'select_state_text' => esc_attr__('Select an option&hellip;', 'woocommerce')));
            }
            wp_enqueue_style('multiple_shipping_styles', plugins_url('css/front.css', __FILE__));
            wp_enqueue_style('tiptip', plugins_url('css/jquery.tiptip.css', __FILE__));
            global $wp_scripts;
            $ui_version = $wp_scripts->registered['jquery-ui-core']->ver;
            wp_enqueue_style("jquery-ui-css", "//ajax.googleapis.com/ajax/libs/jqueryui/{$ui_version}/themes/ui-lightness/jquery-ui.min.css");
            // address validation support
            if (class_exists('WC_Address_Validation') && is_page(woocommerce_get_page_id('multiple_addresses'))) {
                $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
                $validator = $GLOBALS['wc_address_validation'];
                $handler = $validator->handler;
                $params = array('nonce' => wp_create_nonce('wc_address_validation'), 'debug_mode' => 'yes' == get_option('wc_address_validation_debug_mode'), 'force_postcode_lookup' => 'yes' == get_option('wc_address_validation_force_postcode_lookup'), 'ajax_url' => admin_url('admin-ajax.php', 'relative'));
                // load postcode lookup JS
                $provider = $handler->get_active_provider();
                if ($provider && $provider->supports('postcode_lookup')) {
                    wp_enqueue_script('wc_address_validation_postcode_lookup', $validator->get_plugin_url() . '/assets/js/frontend/wc-address-validation-postcode-lookup' . $suffix . '.js', array('jquery', 'woocommerce'), WC_Address_Validation::VERSION, true);
                    wp_localize_script('wc_address_validation_postcode_lookup', 'wc_address_validation_postcode_lookup', $params);
                }
                // load address validation JS
                if ($provider && $provider->supports('address_validation') && 'WC_Address_Validation_Provider_SmartyStreets' == get_class($provider)) {
                    // load SmartyStreets LiveAddress jQuery plugin
                    wp_enqueue_script('wc_address_validation_smarty_streets', '//d79i1fxsrar4t.cloudfront.net/jquery.liveaddress/2.4/jquery.liveaddress.min.js', array('jquery'), '2.4', true);
                    wp_enqueue_script('wcms_address_validation', plugins_url('js/address-validation.js', __FILE__), array('jquery'));
                    $params['smarty_streets_key'] = $provider->html_key;
                    wp_localize_script('wcms_address_validation', 'wc_address_validation', $params);
                    // add a bit of CSS to fix address correction popup from expanding to page width because of Chosen selects
                    echo '<style type="text/css">.chzn-done{position:absolute!important;visibility:hidden!important;display:block!important;width:120px!important;</style>';
                }
                // allow other providers to load JS
                do_action('wc_address_validation_load_js', $provider, $handler, $suffix);
            }
            // on the thank you page, remove the Shipping Address block if the order ships to multiple addresses
            if (isset($_GET['order-received']) || isset($_GET['view-order'])) {
                $order_id = isset($_GET['order-received']) ? intval($_GET['order-received']) : intval($_GET['view-order']);
                $packages = get_post_meta($order_id, '_wcms_packages', true);
                $multiship = get_post_meta($order_id, '_multiple_shipping', true);
                if ($packages && count($packages) > 1 || $multiship == 'yes') {
                    wp_enqueue_script('wcms_shipping_address_override', plugins_url('js/address-override.js', __FILE__), array('jquery'));
                }
            }
        }
 function generate_ms_product_select_html($key, $data)
 {
     global $woocommerce;
     $settings = get_option('woocommerce_multiple_shipping_settings', array());
     $html = '';
     $data['title'] = isset($data['title']) ? $data['title'] : '';
     $data['desc_tip'] = isset($data['desc_tip']) ? $data['desc_tip'] : false;
     $data['description'] = isset($data['description']) ? $data['description'] : '';
     // Description handling
     if ($data['desc_tip'] === true) {
         $description = '';
         $tip = $data['description'];
     } elseif (!empty($data['desc_tip'])) {
         $description = $data['description'];
         $tip = $data['desc_tip'];
     } elseif (!empty($data['description'])) {
         $description = $data['description'];
         $tip = '';
     } else {
         $description = $tip = '';
     }
     // Custom attribute handling
     $custom_attributes = array();
     if (!isset($settings['excluded_products'])) {
         $settings['excluded_products'] = array();
     }
     if (WC_MS_Compatibility::is_wc_version_gte('2.3')) {
         $product_ids = array_filter(array_map('absint', $settings['excluded_products']));
         $json_ids = array();
         foreach ($product_ids as $product_id) {
             $product = wc_get_product($product_id);
             $json_ids[$product_id] = wp_kses_post($product->get_formatted_name());
         }
         $html .= '<tr valign="top">' . "\n";
         $html .= '<th scope="row" class="titledesc">';
         $html .= '<label for="' . esc_attr($this->plugin_id . $this->id . '_' . $key) . '">' . wp_kses_post($data['title']) . '</label>';
         if ($tip) {
             $html .= '<img class="help_tip" data-tip="' . esc_attr($tip) . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" height="16" width="16" />';
         }
         $html .= '</th>' . "\n";
         $html .= '<td class="forminp">' . "\n";
         $html .= '<fieldset><legend class="screen-reader-text"><span>' . wp_kses_post($data['title']) . '</span></legend>' . "\n";
         $html .= '<input
                     type="hidden"
                     data-multiple="true"
                     id="' . esc_attr($this->plugin_id . $this->id . '_' . $key) . '"
                     name="' . esc_attr($this->plugin_id . $this->id . '_' . $key) . '[]"
                     class="wcms-product-search"
                     data-placeholder="' . __('Search for a product&hellip;', 'woocommerce') . '"
                     style="width: 400px"
                     value="' . implode(',', array_keys($json_ids)) . '"
                     data-selected="' . esc_attr(json_encode($json_ids)) . '"
                 >';
         if ($description) {
             $html .= ' <p class="description">' . wp_kses_post($description) . '</p>' . "\n";
         }
         $html .= '</fieldset>';
         $html .= '</td>' . "\n";
         $html .= '</tr>' . "\n";
     } else {
         $html .= '<tr valign="top">' . "\n";
         $html .= '<th scope="row" class="titledesc">';
         $html .= '<label for="' . esc_attr($this->plugin_id . $this->id . '_' . $key) . '">' . wp_kses_post($data['title']) . '</label>';
         if ($tip) {
             $html .= '<img class="help_tip" data-tip="' . esc_attr($tip) . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" height="16" width="16" />';
         }
         $html .= '</th>' . "\n";
         $html .= '<td class="forminp">' . "\n";
         $html .= '<fieldset><legend class="screen-reader-text"><span>' . wp_kses_post($data['title']) . '</span></legend>' . "\n";
         $html .= '<select multiple="multiple" id="' . esc_attr($this->plugin_id . $this->id . '_' . $key) . '" name="' . esc_attr($this->plugin_id . $this->id . '_' . $key) . '[]" class="wcms-product-search" data-placeholder="' . __('Search for a product&hellip;', 'woocommerce') . '" style="width: 400px"><option></option>';
         if (!empty($settings['excluded_products'])) {
             foreach ($settings['excluded_products'] as $pid) {
                 $html .= '<option value="' . $pid . '" selected>#' . $pid . ' - ' . get_the_title($pid) . '</option>';
             }
         }
         $html .= '</select>';
         if ($description) {
             $html .= ' <p class="description">' . wp_kses_post($description) . '</p>' . "\n";
         }
         $html .= '</fieldset>';
         $html .= '</td>' . "\n";
         $html .= '</tr>' . "\n";
     }
     return $html;
 }