/**
  * is_available function.
  *
  * @access public
  * @param mixed $package
  * @return void
  */
 function is_available($package)
 {
     global $woocommerce;
     $methods = wcms_session_get('shipping_methods');
     if (!$methods || empty($methods)) {
         // multiple shipping is not set up
         return false;
     }
     return true;
 }
    ?>
            <h2>
                <?php 
    _e('Shipping Addresses', 'wc_shipping_multiple_address');
    ?>
            <a class="button" href="?address-form"><?php 
    _e('Add New', 'wc_shipping_multiple_address');
    ?>
</a>
            </h2>
            <div id="addresses_container" style="overflow: hidden; width:100%">
                <?php 
    $sigs = array();
    $displayed_addresses = array();
    if (isset($addresses) && !empty($addresses)) {
        $sigs = wcms_session_get('cart_address_sigs');
    }
    foreach ($addresses as $addr_id => $address) {
        if (!isset($address['shipping_first_name'])) {
            continue;
        }
        foreach ($address as $key => $value) {
            $new_key = str_replace('shipping_', '', $key);
            $address[$new_key] = $value;
        }
        $formatted_address = $woocommerce->countries->get_formatted_address($address);
        $json_address = json_encode($address);
        if (!$formatted_address) {
            continue;
        }
        if (in_array($json_address, $displayed_addresses)) {
 /**
  * Check if the contents of the current cart are valid for multiple shipping
  *
  * To pass, there must be 1 or more items in the cart that passes the @see WC_Cart::needs_shipping() test.
  * If there is only 1 item in the cart, it must have a quantity of 2 or more. And child items
  * from Bundles and Composite Products are excluded from the count.
  *
  * This method will automatically return false if the only available shipping method is Local Pickup
  *
  * @return bool
  */
 public function cart_is_eligible_for_multi_shipping()
 {
     global $woocommerce;
     $sess_item_address = wcms_session_get('cart_item_addresses');
     $has_item_address = !wcms_session_isset('cart_item_addresses') || empty($sess_item_address) ? false : true;
     $item_allowed = false;
     $contents = wcms_get_real_cart_items();
     if (count($contents) > 1) {
         $item_allowed = true;
     } else {
         $content = current($contents);
         if ($content && $content['quantity'] > 1) {
             $item_allowed = true;
         }
     }
     // do not allow to set multiple addresses if only local pickup is available
     if (function_exists('wc_add_notice')) {
         $available_methods = $this->get_available_shipping_methods();
     } else {
         $available_methods = $woocommerce->shipping->get_available_shipping_methods();
     }
     if (count($available_methods) == 1 && (isset($available_methods['local_pickup']) || isset($available_methods['local_pickup_plus']))) {
         $item_allowed = false;
     } elseif (isset($_POST['shipping_method']) && ($_POST['shipping_method'] == 'local_pickup' || $_POST['shipping_method'] == 'local_pickup_plus')) {
         $item_allowed = false;
     }
     // do not allow if any of the cart items is in the excludes list
     $settings = get_option('woocommerce_multiple_shipping_settings', array());
     $excl_products = isset($settings['excluded_products']) ? $settings['excluded_products'] : array();
     $excl_categories = isset($settings['excluded_categories']) ? $settings['excluded_categories'] : array();
     if ($excl_products || $excl_categories) {
         foreach ($contents as $cart_item) {
             if (in_array($cart_item['product_id'], $excl_products)) {
                 $item_allowed = false;
                 break;
             }
             // item categories
             $cat_ids = wp_get_object_terms($cart_item['product_id'], 'product_cat', array('fields' => 'ids'));
             foreach ($cat_ids as $cat_id) {
                 if (in_array($cat_id, $excl_categories)) {
                     $item_allowed = false;
                     break 2;
                 }
             }
         }
     }
     return apply_filters('wc_ms_cart_is_eligible', $item_allowed);
 }
 public function subtotal_include_taxes($product_subtotal, $cart_item, $cart_item_key)
 {
     global $woocommerce;
     $packages = wcms_session_get('wcms_packages');
     $tax_based_on = get_option('woocommerce_tax_based_on', 'billing');
     // only process subtotal if multishipping is being used
     if (count($packages) <= 1 || $tax_based_on != 'shipping') {
         return $product_subtotal;
     }
     $subtotal = $this->wcms->get_cart_item_subtotal($cart_item);
     $taxable = $cart_item['data']->is_taxable();
     if ($taxable && $subtotal < $cart_item['line_total'] + $cart_item['line_tax']) {
         if ($woocommerce->cart->tax_display_cart == 'excl') {
             $row_price = $cart_item['line_total'];
             $product_subtotal = wc_price($row_price);
             if ($woocommerce->cart->prices_include_tax && $cart_item['line_tax'] > 0) {
                 $product_subtotal .= ' <small class="tax_label">' . $woocommerce->countries->ex_tax_or_vat() . '</small>';
             }
         } else {
             $row_price = $cart_item['line_total'] + $cart_item['line_tax'];
             $product_subtotal = wc_price($row_price);
             if (!$woocommerce->cart->prices_include_tax && $cart_item['line_tax'] > 0) {
                 $product_subtotal .= ' <small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>';
             }
         }
     }
     return $product_subtotal;
 }
 function calculate_totals($cart)
 {
     global $woocommerce;
     $shipping_total = 0;
     $shipping_taxes = array();
     $shipping_tax_total = 0;
     if (!wcms_session_isset('shipping_methods')) {
         return;
     }
     $packages = $woocommerce->cart->get_shipping_packages();
     $available = $woocommerce->shipping->get_available_shipping_methods();
     $chosen = wcms_session_get('shipping_methods');
     foreach ($packages as $x => $package) {
         if (isset($chosen[$x])) {
             $ship = $chosen[$x]['id'];
             $package = $woocommerce->shipping->calculate_shipping_for_package($package);
             if (isset($package['rates'][$ship])) {
                 $shipping_total += $package['rates'][$ship]->cost;
             }
             if (!empty($package['rates'][$ship]->taxes)) {
                 foreach ($package['rates'][$ship]->taxes as $key => $value) {
                     if (isset($shipping_taxes[$key])) {
                         $shipping_taxes[$key] += $value;
                         $shipping_tax_total += $value;
                     } else {
                         $shipping_taxes[$key] = $value;
                         $shipping_tax_total += $value;
                     }
                 }
             }
         }
     }
     $cart->shipping_taxes = $shipping_taxes;
     $cart->shipping_total = $shipping_total;
     $cart->shipping_tax_total = $shipping_tax_total;
 }
<form method="post" action="" id="address_form">

    <?php 
$addresses = $this->array_sort($addresses, 'shipping_first_name', SORT_ASC);
$relations = wcms_session_get('wcms_item_addresses');
// set the address fields
foreach ($addresses as $x => $addr) {
    if (empty($addr)) {
        continue;
    }
    $address_fields = $woocommerce->countries->get_address_fields($addr['shipping_country'], 'shipping_');
    $address = array();
    $formatted_address = false;
    foreach ($address_fields as $field_name => $field) {
        $addr_key = str_replace('shipping_', '', $field_name);
        $address[$addr_key] = isset($addr[$field_name]) ? $addr[$field_name] : '';
    }
    if (!empty($address)) {
        $formatted_address = $woocommerce->countries->get_formatted_address($address);
        $json_address = json_encode($address);
    }
    if (!$formatted_address) {
        continue;
    }
    ?>
        <div style="display: none;">
            <?php 
    foreach ($shipFields as $key => $field) {
        $val = isset($addr[$key]) ? $addr[$key] : '';
        $key .= '_' . $x;