Changeset 3378681
- Timestamp:
- 10/15/2025 07:55:00 AM (2 months ago)
- Location:
- themehigh-multiple-addresses/trunk
- Files:
-
- 7 edited
-
languages/themehigh-multiple-addresses.pot (modified) (2 diffs)
-
public/assets/js/thmaf-public.js (modified) (2 diffs)
-
public/assets/js/thmaf-public.min.js (modified) (1 diff)
-
public/class-thmaf-public-checkout.php (modified) (4 diffs)
-
public/class-thmaf-public.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
themehigh-multiple-addresses.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
themehigh-multiple-addresses/trunk/languages/themehigh-multiple-addresses.pot
r3301317 r3378681 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Multiple Shipping Addresses for WooCommerce (Address Book) 2. 2.9\n"5 "Project-Id-Version: Multiple Shipping Addresses for WooCommerce (Address Book) 2.3.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/themehigh-multiple-addresses\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025- 05-23T12:01:06+00:00\n"12 "POT-Creation-Date: 2025-10-10T10:17:32+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2. 8.1\n"14 "X-Generator: WP-CLI 2.11.0\n" 15 15 "X-Domain: themehigh-multiple-addresses\n" 16 16 17 17 #. Plugin Name of the plugin 18 #: themehigh-multiple-addresses.php 18 19 msgid "Multiple Shipping Addresses for WooCommerce (Address Book)" 19 20 msgstr "" 20 21 21 22 #. Plugin URI of the plugin 23 #: themehigh-multiple-addresses.php 22 24 msgid "https://www.themehigh.com/product/woocommerce-multiple-addresses-pro" 23 25 msgstr "" 24 26 25 27 #. Description of the plugin 28 #: themehigh-multiple-addresses.php 26 29 msgid "Add and save multiple billing and shipping addresses. And enable the Multiple-shipping feature for a seamless shopping experience." 27 30 msgstr "" 28 31 29 32 #. Author of the plugin 33 #: themehigh-multiple-addresses.php 30 34 msgid "ThemeHigh" 31 35 msgstr "" 32 36 33 37 #. Author URI of the plugin 38 #: themehigh-multiple-addresses.php 34 39 msgid "https://www.themehigh.com/" 35 40 msgstr "" -
themehigh-multiple-addresses/trunk/public/assets/js/thmaf-public.js
r3089201 r3378681 836 836 var cart_shipping = []; 837 837 var data_arr = []; 838 var hidden_ids =[]; 839 840 $('.thmaf-cart-shipping-form-section').find('.thwcfe-disabled-field').each(function(){ 841 hidden_ids.push($(this).attr('id')); 842 }); 838 843 839 844 cart_shipping = $('#cart_shipping_form_wrap :input').serialize(); … … 842 847 security: $( '#cart_ship_form_action' ).val(), 843 848 cart_shipping: cart_shipping, 849 cfe_hide_field : hidden_ids 844 850 }; 845 851 $.ajax({ -
themehigh-multiple-addresses/trunk/public/assets/js/thmaf-public.min.js
r3089201 r3378681 1 function thmaf_delete_selected_address(elm,type,key){address_slider.delete_address(elm,type,key)}function thwma_show_billing_popup(e){thmaf_address.show_billing_popup(e)}function thmaf_show_shipping_popup(e){thmaf_address.show_shipping_popup(e)}function thmaf_add_new_address(e,elm,type){e.preventDefault(),thmaf_address.add_new_address(elm,type,e)}function thmaf_add_new_shipping_address(e,elm,type){e.preventDefault(),thmaf_address.add_new_shipping_address_model(e,elm,type)}function thmaf_populate_selected_address(e,elm,type,key){e.preventDefault(),thmaf_address.populate_selected_address(elm,type,key)}function thmaf_cart_save_address(event){event.preventDefault(),thmaf_address.cart_save_address(event)}function thmaf_close_cart_add_adr_modal(e){thmaf_address.close_cart_add_adr_modal(e)}var address_slider=function($,window,document){"use strict";function delete_address(elm,type,key){activeBillNxt=!0,activeShipNxt=!0,"billing"==type?$("#thmaf-billing-tile-field").append('<div class="ajaxBusy"> <i class="fa fa-spinner" aria-hidden="true"></i></div>'):$("#thmaf-shipping-tile-field").append('<div class="ajaxBusy"> <i class="fa fa-spinner" aria-hidden="true"></i></div>');var selected_address_id=key,selected_type=type,data={action:"delete_address_with_id",security:thmaf_public_var.delete_address_with_id_nonce,selected_address_id:selected_address_id,selected_type:selected_type};$(".ajaxBusy").show(),$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){$("#thmaf-billing-tile-field").html(response.result_billing),$("#thmaf-shipping-tile-field").html(response.result_shipping),$(".ajaxBusy").hide(),$(".thmaf-shipping-adrs-count").val(response.address_count),setup_shipping_address_slider("shipping"),setup_billing_address_slider("billing")}})}function setup_billing_address_slider(type){var list=$(".thmaf-thslider-list.bill"),prevBtn=$(".control-buttons .thmaf-thslider-prev.billing"),nextBtn=$(".control-buttons .thmaf-thslider-next.billing"),total_items=$(".thmaf-thslider-item."+type).length,total_width=230*total_items,initialPos=0,items_limit=total_items-2;list.css("width",total_width),prevBtn.click(function(){activeBillNxt=!0,0!=initialPos&&(initialPos-=1,move_sliders(list,total_items,"-=230",items_limit,initialPos,type))}),nextBtn.click(function(){activeBillNxt&&(initialPos+=1,move_sliders(list,total_items,"+=230",items_limit,initialPos,type))})}function move_sliders(slider,total_items,slid_side,items_limit,initialPos,type){items_limit==initialPos&&("billing"==type?activeBillNxt=!1:activeShipNxt=!1),slider.animate({right:slid_side},{duration:500,complete:function(){}})}function setup_shipping_address_slider(type){var ship_list=$(".thmaf-thslider-list.ship"),ship_prevBtn=$(".control-buttons .thmaf-thslider-prev.shipping"),ship_nextBtn=$(".control-buttons .thmaf-thslider-next.shipping"),ship_total_items=$(".thmaf-thslider-item."+type).length,ship_total_width=230*ship_total_items,ship_initialPos=0,ship_items_limit=ship_total_items-2;ship_list.css("width",ship_total_width),ship_prevBtn.click(function(){activeShipNxt=!0,0!=ship_initialPos&&(ship_initialPos-=1,move_sliders(ship_list,ship_total_items,"-=230",ship_items_limit,ship_initialPos,type))}),ship_nextBtn.click(function(){activeShipNxt&&(ship_initialPos+=1,move_sliders(ship_list,ship_total_items,"+=230",ship_items_limit,ship_initialPos,type))})}var activeBillNxt=!0,activeShipNxt=!0;$(".thmaf-thslider-box").length>0&&$(window).width()>600&&(setup_shipping_address_slider("shipping"),setup_billing_address_slider("billing"));return{delete_address:delete_address}}(window.jQuery,window,document),thmaf_address=function($,window,document){"use strict";function populate_selected_address(elm,address_type,key){var selected_address_id=key,data={action:"get_address_with_id",security:thmaf_public_var.get_address_with_id_nonce,selected_address_id:selected_address_id,selected_type:address_type};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){1===response&&alert("The selected address is doesn't exist, Please reload the page.");var sell_countries=thmaf_public_var.sell_countries,sell_countries_size=Object.keys(sell_countries).length,address_fields=[];address_fields="billing"==address_type?thmaf_public_var.address_fields_billing:thmaf_public_var.address_fields_shipping,$.each(address_fields,function(f_key,f_type){var input_elm="";input_elm=$("radio"==f_type||"checkboxgroup"==f_type?"input[name="+f_key+"]":"#"+f_key);var skip=1==sell_countries_size&&f_key==address_type+"_country";if(1==sell_countries_size&&(skip="billing_country"==f_key),!skip&&input_elm.length){var _type=input_elm.getType(),_value=response[f_key];"file"===f_type&&(_type="file"),thmaf_public_base.set_field_value_by_elm(input_elm,_type,_value)}})}}),"billing"==address_type?($("#thmaf_hidden_field_billing").val(selected_address_id),bpopup.dialog("close")):($("#thmaf_hidden_field_shipping").val(selected_address_id),spopup.dialog("close"))}function show_billing_popup(e){e.preventDefault(),$(".thwma-btn").removeClass("slctd-adrs");var selected_address=$("#thwma_hidden_field_billing").val();selected_address&&$("."+selected_address).addClass("slctd-adrs"),bpopup.dialog("open"),$(".thmaf-billing-adrs-count").val()>=2?$(".button.btn-add-address.primary.button").css("display","none"):$(".button.btn-add-address.primary.button").css("display","inline-block"),active=!1}function show_shipping_popup(e){e.preventDefault(),spopup.dialog("open"),$(".thmaf-shipping-adrs-count").val()>=2?$(".button.btn-add-address.primary.button").css("display","none"):$(".button.btn-add-address.primary.button").css("display","inline-block"),active=!1}function add_new_address(elm,address_type,e){if($("#thmaf-cart-shipping-form-section").css("display","block"),"shipping"===address_type){$(".woocommerce-shipping-fields__field-wrapper").css("display","none"),add_new_shipping_address_model(e,"","shipping");var data={action:"add_new_shipping_address",security:thmaf_public_var.add_new_shipping_address_nonce,selected_type:address_type,multiple_ship:!0};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){$("#thmaf-cart-shipping-form-section").html(response),initialize_select2()}})}var sell_countries=thmaf_public_var.sell_countries,sell_countries_size=Object.keys(sell_countries).length,address_fields=[];"billing"==address_type?(address_fields=thmaf_public_var.address_fields_billing,$("#thmaf_hidden_field_billing").val("add_address")):(address_fields=thmaf_public_var.address_fields_shipping,$("#thmaf_hidden_field_shipping").val("add_address")),$.each(address_fields,function(f_key,f_type){var input_elm="";input_elm=$("radio"==f_type||"checkboxgroup"==f_type?"input[name="+f_key+"]":"#"+f_key);var skip=1==sell_countries_size&&f_key==address_type+"_country";if(1==sell_countries_size&&(skip="billing_country"==f_key),!skip&&input_elm.length){var _type=input_elm.getType();"file"===f_type&&(_type="file"),thmaf_public_base.thmaf_set_field_value_by_elm(input_elm,_type,"")}}),bpopup.dialog("close"),spopup.dialog("close")}function ship_to_multi_address(){var $show=!1,checkout_check=thmaf_public_var.is_checkout_page,ship_to_dif_adr_checkbox=$("input[name=ship_to_multi_address]"),ship_address_count=$(".thmaf-shipping-adrs-count").val(),bill_address_count=$(".thmaf-billing-adrs-count").val();ship_address_count>=2&&($(".thmaf-add-new-address-link").css("display","none"),$("select#thmaf_shipping_alt").find("option[value='add_address']").remove()),bill_address_count>=2&&$("select#thmaf_billing_alt").find("option[value='add_address']").remove(),"no"==ship_to_dif_adr_checkbox.val()?($show=!1,ship_to_dif_adr_checkbox.removeClass("active_multi_ship"),hide_and_show_multi_ship_section($show)):($show=!0,ship_to_dif_adr_checkbox.addClass("active_multi_ship"),hide_and_show_multi_ship_section($show)),$(".woocommerce").on("click","input[name=ship_to_different_address]",function(){if(0==$(this).prop("checked")){ship_to_dif_adr_checkbox.val("no");var value="no"}else if(1==$(this).prop("checked")&&$(".active_multi_ship")[0]){ship_to_dif_adr_checkbox.val("yes");var value="yes"}enable_ship_to_multi_address_ajax(value)});var shipping_section=$("input[name=ship_to_different_address]").prop("checked"),ship_to_multi_address=$("input[name=ship_to_multi_address]").val();if(1==checkout_check){var ship_to_multi_address=$('input[name="ship_to_multi_address"]').val();if(null!=ship_to_multi_address){if(ship_to_multi_address.length){if(1==shipping_section)if("yes"==ship_to_multi_address){$show=!0,ship_to_dif_adr_checkbox.addClass("active_multi_ship"),hide_and_show_multi_ship_section($show);var value="yes"}else $show=!1,ship_to_dif_adr_checkbox.removeClass("active_multi_ship"),hide_and_show_multi_ship_section($show);else var value="no";enable_ship_to_multi_address_ajax(value)}}else $show=!1,hide_and_show_multi_ship_section($show)}$(".woocommerce").on("click","input[name=ship_to_multi_address]",function(){if($(this).is(":checked")){ship_to_dif_adr_checkbox.addClass("active_multi_ship");0==$(this).attr("data-address_count")?($show=!1,hide_and_show_multi_ship_section($show)):($show=!0,hide_and_show_multi_ship_section($show)),$(this).val("yes"),$("#shipping_tiles").css("display","none"),$(".woocommerce-shipping-fields__field-wrapper").css("display","none"),$("p#thwma-shipping-alt_field").css("display","none");$(".ship_to_diff_adr").attr("data-cart_quantity");$(".ship_to_diff_adr").each(function(index){$(this).attr("data-cart_quantity")>1?$(this).css("display","block"):$(this).css("display","none")})}else 0==$(this).prop("checked")&&($("#shipping_tiles").css("display","block"),ship_to_dif_adr_checkbox.removeClass("active_multi_ship"),$show=!1,hide_and_show_multi_ship_section($show),$(this).val("no"));enable_ship_to_multi_address_ajax($(this).val())})}function enable_ship_to_multi_address_ajax(value){var data={action:"enable_ship_to_multi_address",security:thmaf_public_var.enable_ship_to_multi_address_nonce,value:value};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){$("body").trigger("update_checkout")}})}function hide_and_show_multi_ship_section($show){var address_count=$(".thmaf-shipping-adrs-count").val(),multi_ship_wrap=$(".multi-shipping-wrapper"),ms_table=$(".multi-shipping-table"),ms_dropdown=$(".thwma_cart_multi_shipping_display"),shipping_dp=$("#thmaf_shipping_alt"),default_fields=$(".woocommerce-shipping-fields__field-wrapper"),add_new_address=$(".thmaf-add-new-address-link");1==$show?(ms_table.css("display","table"),ms_dropdown.css("display","block"),shipping_dp.css("display","none"),default_fields.css("display","none"),add_new_address.css("display","block"),multi_ship_wrap.css("display","block"),address_count>=2&&($(".thmaf-add-new-address-link").css("display","none"),$("select#thmaf_shipping_alt").find("option[value='add_address']").remove())):(ms_table.css("display","none"),ms_dropdown.css("display","none"),shipping_dp.css("display","block"),default_fields.css("display","block"),add_new_address.css("display","none"),$("#thmaf-cart-shipping-form-section").find("#thmaf-cart-modal-content2").remove())}function select_cart_mutlti_shipping(){$(".woocommerce").on("change","select.thwma-cart-shipping-options",function(){$(".multi-shipping-table-overlay").append('<div class="ajaxBusy"> <i class="fa fa-spinner" aria-hidden="true"></i></div>'),$(".multi-shipping-table-overlay").css("display","block"),$(".ajaxBusy").show();var value=$(this).val(),$this=$(this),product_id=$(this).attr("data-product_id"),cart_key=$(this).attr("data-cart_key"),multi_ship_item=($(this).attr("data-exist_multi_adr"),$this.closest("tr").find(".multi-ship-item")),multi_ship_id=multi_ship_item.data("multi_ship_id"),exist_multi_ship=$(".multi-shipping-adr-data").val(),multi_ship_data=[];if(""!=multi_ship_data){if(void 0!=exist_multi_ship)var multi_ship_data=JSON.parse(exist_multi_ship);jQuery.each(multi_ship_data,function(index,val){multi_ship_data[cart_key]={product_id:product_id,address_name:value}})}var new_multi_ship_dta="";if(void 0!=multi_ship_data)var new_multi_ship_dta=JSON.stringify(multi_ship_data);$(".multi-shipping-adr-data").val(new_multi_ship_dta);var first_tr=$this.closest("table").find("tr:nth-child(2)"),first_set_adrs=first_tr.find("select.thwma-cart-shipping-options").val();null!=first_set_adrs&&""!=first_set_adrs?populate_selected_address("","shipping",first_set_adrs):set_default_adr_to_shipping_fields();var data={action:"save_multi_selected_shipping",security:thmaf_public_var.save_multi_selected_shipping_nonce,value:value,product_id:product_id,cart_key:cart_key,multi_ship_id:multi_ship_id};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){$(".address-limiting-message").hide(),response.length>0?($(".multi-shipping-table-wrapper").prepend("<p class='address-limiting-message woocommerce-error'>"+response+"</p>"),$this.css("border-color","red"),$this.val("")):($(".address-limiting-message").hide(),$this.css("border-color","#767676")),shipping_method_change(),$(".ajaxBusy").hide(),$(".multi-shipping-table-overlay").css("display","none")}})})}function initialize_select2(){$("select#shipping_country").select2({tags:!0}),$("select#shipping_state").select2({tags:!0})}function set_default_adr_to_shipping_fields(){var first_set_adrs="",first_tr=$("table.multi-shipping-table").find("tr:nth-child(2)"),first_set_adrs=first_tr.find("select.thwma-cart-shipping-options").val();if(null!=first_set_adrs&&""!=first_set_adrs){populate_selected_address("","shipping",first_set_adrs)}else{var ship_default_adr=jQuery("[name='ship_default_adr']").val();if(null!=ship_default_adr){var response="";if(void 0!=ship_default_adr)var response=jQuery.parseJSON(ship_default_adr);var sell_countries=thmaf_public_var.sell_countries,sell_countries_size=Object.keys(sell_countries).length,address_fields=[];address_fields=thmaf_public_var.address_fields_shipping,$.each(address_fields,function(f_key,f_type){var input_elm="";input_elm=$("radio"==f_type||"checkboxgroup"==f_type?"input[name="+f_key+"]":"#"+f_key);var skip=1==sell_countries_size&&"shipping_country"==f_key;if(1==sell_countries_size&&(skip="billing_country"==f_key),!skip&&input_elm.length){var _type=input_elm.getType(),_value=response[f_key];"file"===f_type&&(_type="file"),thmaf_public_base.set_field_value_by_elm(input_elm,_type,_value,f_key)}})}}}function shipping_method_change(){$("body").trigger("update_checkout");var ship_mthd_arry=[];setTimeout(function(){$('select.shipping_method, input[name^="shipping_method"][type="radio"]:checked').each(function(){var method_id=$(this).val(),nearest_ul_id=$(this).closest("ul").attr("id"),ship_cart_key=$(this).closest("ul").siblings(".ship-cart-key").val(),ship_cart_unique_key=$(this).closest("ul").siblings(".ship-cart-unique-key").val(),item_name=$(this).closest("ul").siblings(".ship-product-name").text(),item_qty=$(this).closest("ul").siblings(".ship-product-qty").val(),product_id=$(this).closest("ul").siblings(".ship-product-id").val(),shipping_adrs=$(this).closest("ul").siblings(".ship-address-formated").val(),shipping_name=$(this).closest("ul").siblings(".ship-address-name").val();item_name=item_name.replace(":","");var shipping_array={method_id:method_id,parent_ul_id:nearest_ul_id,cart_key:ship_cart_key,cart_unique_key:ship_cart_unique_key,item_name:item_name,product_id:product_id,shipping_adrs:shipping_adrs,shipping_name:shipping_name,item_qty:item_qty};ship_mthd_arry.push(shipping_array)});var data={action:"save_shipping_method_details",security:thmaf_public_var.save_shipping_method_details_nonce,ship_method_arr:ship_mthd_arry};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){}})},2e3);var checkout_form=$("form.checkout");checkout_form.on("change",'input[name^="shipping_method"]',function(e){var method_id=$(this).val(),ship_cart_key=($(this).closest("ul").attr("id"),$(this).closest("ul").siblings(".ship-cart-key").val()),item_name=($(this).closest("ul").siblings(".ship-cart-unique-key").val(),$(this).closest("ul").siblings(".ship-product-name").text());$(this).closest("ul").siblings(".ship-product-qty").val(),$(this).closest("ul").siblings(".ship-product-id").val(),$(this).closest("ul").siblings(".ship-address-formated").val(),$(this).closest("ul").siblings(".ship-address-name").val();item_name=item_name.replace(":","");Object.create(null);ship_mthd_arry.forEach(function(entry){entry.cart_key==ship_cart_key&&(entry.method_id=method_id)});var data={action:"save_shipping_method_details",security:thmaf_public_var.save_shipping_method_details_nonce,ship_method_arr:ship_mthd_arry};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){}})})}function add_new_shipping_address_model(e,elm,type){e.preventDefault(),$("#thmaf-cart-shipping-form-section").css("display","block");var data={action:"add_new_shipping_address",security:thmaf_public_var.add_new_shipping_address_nonce,selected_type:type};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){$("#thmaf-cart-shipping-form-section").html(response),initialize_select2()}})}function cart_save_address(e){$(".woocodfdfmmerce-shipping-fields__field-wrapper").html('<div class="ajaxBusy"> <i class="fa fa-spinner" aria-hidden="true"></i></div>'),e.preventDefault(),$(".ajaxBusy").show();var cart_shipping=[] ;cart_shipping=$("#cart_shipping_form_wrap :input").serialize();var data={action:"thmaf_save_address",security:$("#cart_ship_form_action").val(),cart_shipping:cart_shipping};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){if("true"==response.true_check){$(".multi-shipping-wrapper").html(response.output_table),$("select#thmaf_shipping_alt").append(response.address_dropdown),$(".multi-shipping-wrapper").css("display","none");var mul_ship_enable=$("#thmaf-enable-multiple-shipping").val();$(".woocommerce-shipping-fields__field-wrapper").css("display","block"),"yes"==mul_ship_enable&&($(".multi-shipping-wrapper").css("display","block"),$(".woocommerce-shipping-fields__field-wrapper").css("display","none")),$(".ajaxBusy").hide(),$("#thmaf-cart-shipping-form-section").find("#thmaf-cart-modal-content2").remove(),$(".thmaf-shipping-adrs-count").val(response.address_count),$(".thmaf-thslider").html(response.result_shipping),response.address_count>=2&&($(".thmaf-add-new-address-link").css("display","none"),$("select#thmaf_shipping_alt").find("option[value='add_address']").remove())}else $(".thmaf_hidden_error_mssgs").addClass("show_msgs"),$(".thmaf_hidden_error_mssgs.show_msgs").html(response.true_check),$(".ajaxBusy").hide()}})}function close_cart_add_adr_modal(e){$("#thmaf-cart-shipping-form-section").find("#thmaf-cart-modal-content2").remove(),$(".woocommerce-shipping-fields__field-wrapper").css("display","block"),"yes"==$("#thmaf-enable-multiple-shipping").val()&&$(".woocommerce-shipping-fields__field-wrapper").css("display","none")}var default_shipping=$("#thmaf_checkbox_shipping").val();ship_to_multi_address(),select_cart_mutlti_shipping(),shipping_method_change();var active=!1,bpopup=$("#thmaf-billing-tile-field"),spopup=$("#thmaf-shipping-tile-field");if($(window).width()<600){var popupwidth=$(window).width()-20;bpopup.dialog({dialogClass:"wp-dialog thmaf-popup",title:thmaf_public_var.billing_address,modal:!0,autoOpen:!1,width:popupwidth}),spopup.dialog({dialogClass:"wp-dialog thmaf-popup",title:thmaf_public_var.shipping_address,modal:!0,autoOpen:!1,width:popupwidth})}else bpopup.dialog({dialogClass:"wp-dialog thmaf-popup",title:thmaf_public_var.billing_address,modal:!0,autoOpen:!1,minHeight:400,maxHeight:600,width:780}),spopup.dialog({dialogClass:"wp-dialog thmaf-popup",title:thmaf_public_var.shipping_address,modal:!0,autoOpen:!1,minHeight:400,maxHeight:600,width:780});return $("#thmaf_billing_alt").change(function(event){event.preventDefault();var select_type=this.value;"add_address"==select_type?add_new_address("","billing"):populate_selected_address("","billing",select_type)}),$("#thmaf_shipping_alt").change(function(event){event.preventDefault();var select_type=this.value;"add_address"==select_type?add_new_address("","shipping",event):populate_selected_address("","shipping",select_type)}),$("#ship-to-different-address-checkbox").change(function(){$("#ship-to-different-address-checkbox").is(":checked")?$("#thmaf_checkbox_shipping").val("ship_select"):$("#thmaf_checkbox_shipping").val(default_shipping)}),$("input.active_multi_ship").is(":checked")?$("#shipping_tiles").css("display","none"):$("#shipping_tiles").css("display","block"),{show_billing_popup:show_billing_popup,show_shipping_popup:show_shipping_popup,populate_selected_address:populate_selected_address,add_new_address:add_new_address,ship_to_multi_address:ship_to_multi_address,select_cart_mutlti_shipping:select_cart_mutlti_shipping,shipping_method_change:shipping_method_change,add_new_shipping_address_model:add_new_shipping_address_model,cart_save_address:cart_save_address,close_cart_add_adr_modal:close_cart_add_adr_modal}}(window.jQuery,window,document),thmaf_public_base=function($,window,document){"use strict";function display_char_count(elm,isCount){var fid=elm.prop("id"),len=elm.val().length,displayElm=$("#"+fid+"-char-count");if(isCount)displayElm.text("("+len+" characters)");else{var maxLen=elm.prop("maxlength"),left=maxLen-len;displayElm.text("("+left+" characters left)"),rem<0&&displayElm.css("color","red")}}function set_field_value_by_elm(elm,type,value){switch(type){case"radio":elm.val([value]);break;case"checkbox":1==elm.data("multiple")?(value=value||[],elm.val([value]).change()):elm.val([value]).change();break;case"select":if(1==thmaf_public_var.select_options){var option_values=[];elm.find("option").each(function(option_key,option_val){""!=$(this).val()&&(option_values[option_key]=$(this).val())}),-1!=$.inArray(value,option_values)?elm.prop("multiple")?elm.val(value):elm.val([value]).change():(elm.append($("<option></option>").attr("value",value).text(value)),elm.val([value]).change())}else elm.prop("multiple")?elm.val(value):elm.val([value]).change();break;case"multiselect":elm.prop("multiple")?void 0!==value&&elm.val(value.split(",")).change():elm.val([value]).change();break;case"hidden":break;default:elm.val(value).change()}}function thmaf_set_field_value_by_elm(elm,type,value){switch(type){case"radio":elm.prop("checked",!1);break;case"checkbox":1==elm.data("multiple")?(value=value||[],elm.prop("checked",!1)):elm.prop("checked",!1);break;case"select":if(1==thmaf_public_var.select_options){var option_values=[];elm.find("option").each(function(option_key,option_val){""!=$(this).val()&&(option_values[option_key]=$(this).val())}),-1!=$.inArray(value,option_values)?(elm.prop("multiple"),elm.val("")):(elm.append($("<option></option>").attr("value",value).text(value)),elm.val(""))}else elm.prop("multiple")?elm.val(""):(elm.val([value]).change(),$(".form-row.woocommerce-invalid .select2-selection").css({"border-color":"#aaa","border-width":"1px","border-style":"solid"}));break;case"multiselect":elm.prop("multiple")?void 0!==value&&elm.val(value.split(",")).val(""):elm.val("");break;case"hidden":break;case"email":elm.val(""),elm.attr("autocomplete","off");break;default:elm.val("")}elm.closest("p").removeClass("woocommerce-validated"),elm.closest("p").removeClass("woocommerce-invalid")}function get_field_value(type,elm,name){var value="";switch(type){case"radio":value=$("input[type=radio][name="+name+"]:checked").val();break;case"checkbox":if(1==elm.data("multiple")){var valueArr=[];$("input[type=checkbox][name='"+name+"[]']:checked").each(function(){valueArr.push($(this).val())}),value=valueArr}else value=$("input[type=checkbox][name="+name+"]:checked").val();break;case"select":case"multiselect":default:value=elm.val()}return value}return $.fn.getType=function(){try{return"INPUT"==this[0].tagName?this[0].type.toLowerCase():this[0].tagName.toLowerCase()}catch(err){return"E001"}},{display_char_count:display_char_count,set_field_value_by_elm:set_field_value_by_elm,thmaf_set_field_value_by_elm:thmaf_set_field_value_by_elm,get_field_value:get_field_value}}(window.jQuery,window,document);!function($){"use strict";!function(){$(".wrapper-class")}()}(jQuery);1 function thmaf_delete_selected_address(elm,type,key){address_slider.delete_address(elm,type,key)}function thwma_show_billing_popup(e){thmaf_address.show_billing_popup(e)}function thmaf_show_shipping_popup(e){thmaf_address.show_shipping_popup(e)}function thmaf_add_new_address(e,elm,type){e.preventDefault(),thmaf_address.add_new_address(elm,type,e)}function thmaf_add_new_shipping_address(e,elm,type){e.preventDefault(),thmaf_address.add_new_shipping_address_model(e,elm,type)}function thmaf_populate_selected_address(e,elm,type,key){e.preventDefault(),thmaf_address.populate_selected_address(elm,type,key)}function thmaf_cart_save_address(event){event.preventDefault(),thmaf_address.cart_save_address(event)}function thmaf_close_cart_add_adr_modal(e){thmaf_address.close_cart_add_adr_modal(e)}var address_slider=function($,window,document){"use strict";function delete_address(elm,type,key){activeBillNxt=!0,activeShipNxt=!0,"billing"==type?$("#thmaf-billing-tile-field").append('<div class="ajaxBusy"> <i class="fa fa-spinner" aria-hidden="true"></i></div>'):$("#thmaf-shipping-tile-field").append('<div class="ajaxBusy"> <i class="fa fa-spinner" aria-hidden="true"></i></div>');var selected_address_id=key,selected_type=type,data={action:"delete_address_with_id",security:thmaf_public_var.delete_address_with_id_nonce,selected_address_id:selected_address_id,selected_type:selected_type};$(".ajaxBusy").show(),$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){$("#thmaf-billing-tile-field").html(response.result_billing),$("#thmaf-shipping-tile-field").html(response.result_shipping),$(".ajaxBusy").hide(),$(".thmaf-shipping-adrs-count").val(response.address_count),setup_shipping_address_slider("shipping"),setup_billing_address_slider("billing")}})}function setup_billing_address_slider(type){var list=$(".thmaf-thslider-list.bill"),prevBtn=$(".control-buttons .thmaf-thslider-prev.billing"),nextBtn=$(".control-buttons .thmaf-thslider-next.billing"),total_items=$(".thmaf-thslider-item."+type).length,total_width=230*total_items,initialPos=0,items_limit=total_items-2;list.css("width",total_width),prevBtn.click(function(){activeBillNxt=!0,0!=initialPos&&(initialPos-=1,move_sliders(list,total_items,"-=230",items_limit,initialPos,type))}),nextBtn.click(function(){activeBillNxt&&(initialPos+=1,move_sliders(list,total_items,"+=230",items_limit,initialPos,type))})}function move_sliders(slider,total_items,slid_side,items_limit,initialPos,type){items_limit==initialPos&&("billing"==type?activeBillNxt=!1:activeShipNxt=!1),slider.animate({right:slid_side},{duration:500,complete:function(){}})}function setup_shipping_address_slider(type){var ship_list=$(".thmaf-thslider-list.ship"),ship_prevBtn=$(".control-buttons .thmaf-thslider-prev.shipping"),ship_nextBtn=$(".control-buttons .thmaf-thslider-next.shipping"),ship_total_items=$(".thmaf-thslider-item."+type).length,ship_total_width=230*ship_total_items,ship_initialPos=0,ship_items_limit=ship_total_items-2;ship_list.css("width",ship_total_width),ship_prevBtn.click(function(){activeShipNxt=!0,0!=ship_initialPos&&(ship_initialPos-=1,move_sliders(ship_list,ship_total_items,"-=230",ship_items_limit,ship_initialPos,type))}),ship_nextBtn.click(function(){activeShipNxt&&(ship_initialPos+=1,move_sliders(ship_list,ship_total_items,"+=230",ship_items_limit,ship_initialPos,type))})}var activeBillNxt=!0,activeShipNxt=!0;$(".thmaf-thslider-box").length>0&&$(window).width()>600&&(setup_shipping_address_slider("shipping"),setup_billing_address_slider("billing"));return{delete_address:delete_address}}(window.jQuery,window,document),thmaf_address=function($,window,document){"use strict";function populate_selected_address(elm,address_type,key){var selected_address_id=key,data={action:"get_address_with_id",security:thmaf_public_var.get_address_with_id_nonce,selected_address_id:selected_address_id,selected_type:address_type};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){1===response&&alert("The selected address is doesn't exist, Please reload the page.");var sell_countries=thmaf_public_var.sell_countries,sell_countries_size=Object.keys(sell_countries).length,address_fields=[];address_fields="billing"==address_type?thmaf_public_var.address_fields_billing:thmaf_public_var.address_fields_shipping,$.each(address_fields,function(f_key,f_type){var input_elm="";input_elm=$("radio"==f_type||"checkboxgroup"==f_type?"input[name="+f_key+"]":"#"+f_key);var skip=1==sell_countries_size&&f_key==address_type+"_country";if(1==sell_countries_size&&(skip="billing_country"==f_key),!skip&&input_elm.length){var _type=input_elm.getType(),_value=response[f_key];"file"===f_type&&(_type="file"),thmaf_public_base.set_field_value_by_elm(input_elm,_type,_value)}})}}),"billing"==address_type?($("#thmaf_hidden_field_billing").val(selected_address_id),bpopup.dialog("close")):($("#thmaf_hidden_field_shipping").val(selected_address_id),spopup.dialog("close"))}function show_billing_popup(e){e.preventDefault(),$(".thwma-btn").removeClass("slctd-adrs");var selected_address=$("#thwma_hidden_field_billing").val();selected_address&&$("."+selected_address).addClass("slctd-adrs"),bpopup.dialog("open"),$(".thmaf-billing-adrs-count").val()>=2?$(".button.btn-add-address.primary.button").css("display","none"):$(".button.btn-add-address.primary.button").css("display","inline-block"),active=!1}function show_shipping_popup(e){e.preventDefault(),spopup.dialog("open"),$(".thmaf-shipping-adrs-count").val()>=2?$(".button.btn-add-address.primary.button").css("display","none"):$(".button.btn-add-address.primary.button").css("display","inline-block"),active=!1}function add_new_address(elm,address_type,e){if($("#thmaf-cart-shipping-form-section").css("display","block"),"shipping"===address_type){$(".woocommerce-shipping-fields__field-wrapper").css("display","none"),add_new_shipping_address_model(e,"","shipping");var data={action:"add_new_shipping_address",security:thmaf_public_var.add_new_shipping_address_nonce,selected_type:address_type,multiple_ship:!0};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){$("#thmaf-cart-shipping-form-section").html(response),initialize_select2()}})}var sell_countries=thmaf_public_var.sell_countries,sell_countries_size=Object.keys(sell_countries).length,address_fields=[];"billing"==address_type?(address_fields=thmaf_public_var.address_fields_billing,$("#thmaf_hidden_field_billing").val("add_address")):(address_fields=thmaf_public_var.address_fields_shipping,$("#thmaf_hidden_field_shipping").val("add_address")),$.each(address_fields,function(f_key,f_type){var input_elm="";input_elm=$("radio"==f_type||"checkboxgroup"==f_type?"input[name="+f_key+"]":"#"+f_key);var skip=1==sell_countries_size&&f_key==address_type+"_country";if(1==sell_countries_size&&(skip="billing_country"==f_key),!skip&&input_elm.length){var _type=input_elm.getType();"file"===f_type&&(_type="file"),thmaf_public_base.thmaf_set_field_value_by_elm(input_elm,_type,"")}}),bpopup.dialog("close"),spopup.dialog("close")}function ship_to_multi_address(){var $show=!1,checkout_check=thmaf_public_var.is_checkout_page,ship_to_dif_adr_checkbox=$("input[name=ship_to_multi_address]"),ship_address_count=$(".thmaf-shipping-adrs-count").val(),bill_address_count=$(".thmaf-billing-adrs-count").val();ship_address_count>=2&&($(".thmaf-add-new-address-link").css("display","none"),$("select#thmaf_shipping_alt").find("option[value='add_address']").remove()),bill_address_count>=2&&$("select#thmaf_billing_alt").find("option[value='add_address']").remove(),"no"==ship_to_dif_adr_checkbox.val()?($show=!1,ship_to_dif_adr_checkbox.removeClass("active_multi_ship"),hide_and_show_multi_ship_section($show)):($show=!0,ship_to_dif_adr_checkbox.addClass("active_multi_ship"),hide_and_show_multi_ship_section($show)),$(".woocommerce").on("click","input[name=ship_to_different_address]",function(){if(0==$(this).prop("checked")){ship_to_dif_adr_checkbox.val("no");var value="no"}else if(1==$(this).prop("checked")&&$(".active_multi_ship")[0]){ship_to_dif_adr_checkbox.val("yes");var value="yes"}enable_ship_to_multi_address_ajax(value)});var shipping_section=$("input[name=ship_to_different_address]").prop("checked"),ship_to_multi_address=$("input[name=ship_to_multi_address]").val();if(1==checkout_check){var ship_to_multi_address=$('input[name="ship_to_multi_address"]').val();if(null!=ship_to_multi_address){if(ship_to_multi_address.length){if(1==shipping_section)if("yes"==ship_to_multi_address){$show=!0,ship_to_dif_adr_checkbox.addClass("active_multi_ship"),hide_and_show_multi_ship_section($show);var value="yes"}else $show=!1,ship_to_dif_adr_checkbox.removeClass("active_multi_ship"),hide_and_show_multi_ship_section($show);else var value="no";enable_ship_to_multi_address_ajax(value)}}else $show=!1,hide_and_show_multi_ship_section($show)}$(".woocommerce").on("click","input[name=ship_to_multi_address]",function(){if($(this).is(":checked")){ship_to_dif_adr_checkbox.addClass("active_multi_ship");0==$(this).attr("data-address_count")?($show=!1,hide_and_show_multi_ship_section($show)):($show=!0,hide_and_show_multi_ship_section($show)),$(this).val("yes"),$("#shipping_tiles").css("display","none"),$(".woocommerce-shipping-fields__field-wrapper").css("display","none"),$("p#thwma-shipping-alt_field").css("display","none");$(".ship_to_diff_adr").attr("data-cart_quantity");$(".ship_to_diff_adr").each(function(index){$(this).attr("data-cart_quantity")>1?$(this).css("display","block"):$(this).css("display","none")})}else 0==$(this).prop("checked")&&($("#shipping_tiles").css("display","block"),ship_to_dif_adr_checkbox.removeClass("active_multi_ship"),$show=!1,hide_and_show_multi_ship_section($show),$(this).val("no"));enable_ship_to_multi_address_ajax($(this).val())})}function enable_ship_to_multi_address_ajax(value){var data={action:"enable_ship_to_multi_address",security:thmaf_public_var.enable_ship_to_multi_address_nonce,value:value};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){$("body").trigger("update_checkout")}})}function hide_and_show_multi_ship_section($show){var address_count=$(".thmaf-shipping-adrs-count").val(),multi_ship_wrap=$(".multi-shipping-wrapper"),ms_table=$(".multi-shipping-table"),ms_dropdown=$(".thwma_cart_multi_shipping_display"),shipping_dp=$("#thmaf_shipping_alt"),default_fields=$(".woocommerce-shipping-fields__field-wrapper"),add_new_address=$(".thmaf-add-new-address-link");1==$show?(ms_table.css("display","table"),ms_dropdown.css("display","block"),shipping_dp.css("display","none"),default_fields.css("display","none"),add_new_address.css("display","block"),multi_ship_wrap.css("display","block"),address_count>=2&&($(".thmaf-add-new-address-link").css("display","none"),$("select#thmaf_shipping_alt").find("option[value='add_address']").remove())):(ms_table.css("display","none"),ms_dropdown.css("display","none"),shipping_dp.css("display","block"),default_fields.css("display","block"),add_new_address.css("display","none"),$("#thmaf-cart-shipping-form-section").find("#thmaf-cart-modal-content2").remove())}function select_cart_mutlti_shipping(){$(".woocommerce").on("change","select.thwma-cart-shipping-options",function(){$(".multi-shipping-table-overlay").append('<div class="ajaxBusy"> <i class="fa fa-spinner" aria-hidden="true"></i></div>'),$(".multi-shipping-table-overlay").css("display","block"),$(".ajaxBusy").show();var value=$(this).val(),$this=$(this),product_id=$(this).attr("data-product_id"),cart_key=$(this).attr("data-cart_key"),multi_ship_item=($(this).attr("data-exist_multi_adr"),$this.closest("tr").find(".multi-ship-item")),multi_ship_id=multi_ship_item.data("multi_ship_id"),exist_multi_ship=$(".multi-shipping-adr-data").val(),multi_ship_data=[];if(""!=multi_ship_data){if(void 0!=exist_multi_ship)var multi_ship_data=JSON.parse(exist_multi_ship);jQuery.each(multi_ship_data,function(index,val){multi_ship_data[cart_key]={product_id:product_id,address_name:value}})}var new_multi_ship_dta="";if(void 0!=multi_ship_data)var new_multi_ship_dta=JSON.stringify(multi_ship_data);$(".multi-shipping-adr-data").val(new_multi_ship_dta);var first_tr=$this.closest("table").find("tr:nth-child(2)"),first_set_adrs=first_tr.find("select.thwma-cart-shipping-options").val();null!=first_set_adrs&&""!=first_set_adrs?populate_selected_address("","shipping",first_set_adrs):set_default_adr_to_shipping_fields();var data={action:"save_multi_selected_shipping",security:thmaf_public_var.save_multi_selected_shipping_nonce,value:value,product_id:product_id,cart_key:cart_key,multi_ship_id:multi_ship_id};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){$(".address-limiting-message").hide(),response.length>0?($(".multi-shipping-table-wrapper").prepend("<p class='address-limiting-message woocommerce-error'>"+response+"</p>"),$this.css("border-color","red"),$this.val("")):($(".address-limiting-message").hide(),$this.css("border-color","#767676")),shipping_method_change(),$(".ajaxBusy").hide(),$(".multi-shipping-table-overlay").css("display","none")}})})}function initialize_select2(){$("select#shipping_country").select2({tags:!0}),$("select#shipping_state").select2({tags:!0})}function set_default_adr_to_shipping_fields(){var first_set_adrs="",first_tr=$("table.multi-shipping-table").find("tr:nth-child(2)"),first_set_adrs=first_tr.find("select.thwma-cart-shipping-options").val();if(null!=first_set_adrs&&""!=first_set_adrs){populate_selected_address("","shipping",first_set_adrs)}else{var ship_default_adr=jQuery("[name='ship_default_adr']").val();if(null!=ship_default_adr){var response="";if(void 0!=ship_default_adr)var response=jQuery.parseJSON(ship_default_adr);var sell_countries=thmaf_public_var.sell_countries,sell_countries_size=Object.keys(sell_countries).length,address_fields=[];address_fields=thmaf_public_var.address_fields_shipping,$.each(address_fields,function(f_key,f_type){var input_elm="";input_elm=$("radio"==f_type||"checkboxgroup"==f_type?"input[name="+f_key+"]":"#"+f_key);var skip=1==sell_countries_size&&"shipping_country"==f_key;if(1==sell_countries_size&&(skip="billing_country"==f_key),!skip&&input_elm.length){var _type=input_elm.getType(),_value=response[f_key];"file"===f_type&&(_type="file"),thmaf_public_base.set_field_value_by_elm(input_elm,_type,_value,f_key)}})}}}function shipping_method_change(){$("body").trigger("update_checkout");var ship_mthd_arry=[];setTimeout(function(){$('select.shipping_method, input[name^="shipping_method"][type="radio"]:checked').each(function(){var method_id=$(this).val(),nearest_ul_id=$(this).closest("ul").attr("id"),ship_cart_key=$(this).closest("ul").siblings(".ship-cart-key").val(),ship_cart_unique_key=$(this).closest("ul").siblings(".ship-cart-unique-key").val(),item_name=$(this).closest("ul").siblings(".ship-product-name").text(),item_qty=$(this).closest("ul").siblings(".ship-product-qty").val(),product_id=$(this).closest("ul").siblings(".ship-product-id").val(),shipping_adrs=$(this).closest("ul").siblings(".ship-address-formated").val(),shipping_name=$(this).closest("ul").siblings(".ship-address-name").val();item_name=item_name.replace(":","");var shipping_array={method_id:method_id,parent_ul_id:nearest_ul_id,cart_key:ship_cart_key,cart_unique_key:ship_cart_unique_key,item_name:item_name,product_id:product_id,shipping_adrs:shipping_adrs,shipping_name:shipping_name,item_qty:item_qty};ship_mthd_arry.push(shipping_array)});var data={action:"save_shipping_method_details",security:thmaf_public_var.save_shipping_method_details_nonce,ship_method_arr:ship_mthd_arry};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){}})},2e3);var checkout_form=$("form.checkout");checkout_form.on("change",'input[name^="shipping_method"]',function(e){var method_id=$(this).val(),ship_cart_key=($(this).closest("ul").attr("id"),$(this).closest("ul").siblings(".ship-cart-key").val()),item_name=($(this).closest("ul").siblings(".ship-cart-unique-key").val(),$(this).closest("ul").siblings(".ship-product-name").text());$(this).closest("ul").siblings(".ship-product-qty").val(),$(this).closest("ul").siblings(".ship-product-id").val(),$(this).closest("ul").siblings(".ship-address-formated").val(),$(this).closest("ul").siblings(".ship-address-name").val();item_name=item_name.replace(":","");Object.create(null);ship_mthd_arry.forEach(function(entry){entry.cart_key==ship_cart_key&&(entry.method_id=method_id)});var data={action:"save_shipping_method_details",security:thmaf_public_var.save_shipping_method_details_nonce,ship_method_arr:ship_mthd_arry};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){}})})}function add_new_shipping_address_model(e,elm,type){e.preventDefault(),$("#thmaf-cart-shipping-form-section").css("display","block");var data={action:"add_new_shipping_address",security:thmaf_public_var.add_new_shipping_address_nonce,selected_type:type};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){$("#thmaf-cart-shipping-form-section").html(response),initialize_select2()}})}function cart_save_address(e){$(".woocodfdfmmerce-shipping-fields__field-wrapper").html('<div class="ajaxBusy"> <i class="fa fa-spinner" aria-hidden="true"></i></div>'),e.preventDefault(),$(".ajaxBusy").show();var cart_shipping=[],hidden_ids=[];$(".thmaf-cart-shipping-form-section").find(".thwcfe-disabled-field").each(function(){hidden_ids.push($(this).attr("id"))}),cart_shipping=$("#cart_shipping_form_wrap :input").serialize();var data={action:"thmaf_save_address",security:$("#cart_ship_form_action").val(),cart_shipping:cart_shipping,cfe_hide_field:hidden_ids};$.ajax({url:thmaf_public_var.ajax_url,data:data,type:"POST",success:function(response){if("true"==response.true_check){$(".multi-shipping-wrapper").html(response.output_table),$("select#thmaf_shipping_alt").append(response.address_dropdown),$(".multi-shipping-wrapper").css("display","none");var mul_ship_enable=$("#thmaf-enable-multiple-shipping").val();$(".woocommerce-shipping-fields__field-wrapper").css("display","block"),"yes"==mul_ship_enable&&($(".multi-shipping-wrapper").css("display","block"),$(".woocommerce-shipping-fields__field-wrapper").css("display","none")),$(".ajaxBusy").hide(),$("#thmaf-cart-shipping-form-section").find("#thmaf-cart-modal-content2").remove(),$(".thmaf-shipping-adrs-count").val(response.address_count),$(".thmaf-thslider").html(response.result_shipping),response.address_count>=2&&($(".thmaf-add-new-address-link").css("display","none"),$("select#thmaf_shipping_alt").find("option[value='add_address']").remove())}else $(".thmaf_hidden_error_mssgs").addClass("show_msgs"),$(".thmaf_hidden_error_mssgs.show_msgs").html(response.true_check),$(".ajaxBusy").hide()}})}function close_cart_add_adr_modal(e){$("#thmaf-cart-shipping-form-section").find("#thmaf-cart-modal-content2").remove(),$(".woocommerce-shipping-fields__field-wrapper").css("display","block"),"yes"==$("#thmaf-enable-multiple-shipping").val()&&$(".woocommerce-shipping-fields__field-wrapper").css("display","none")}var default_shipping=$("#thmaf_checkbox_shipping").val();ship_to_multi_address(),select_cart_mutlti_shipping(),shipping_method_change();var active=!1,bpopup=$("#thmaf-billing-tile-field"),spopup=$("#thmaf-shipping-tile-field");if($(window).width()<600){var popupwidth=$(window).width()-20;bpopup.dialog({dialogClass:"wp-dialog thmaf-popup",title:thmaf_public_var.billing_address,modal:!0,autoOpen:!1,width:popupwidth}),spopup.dialog({dialogClass:"wp-dialog thmaf-popup",title:thmaf_public_var.shipping_address,modal:!0,autoOpen:!1,width:popupwidth})}else bpopup.dialog({dialogClass:"wp-dialog thmaf-popup",title:thmaf_public_var.billing_address,modal:!0,autoOpen:!1,minHeight:400,maxHeight:600,width:780}),spopup.dialog({dialogClass:"wp-dialog thmaf-popup",title:thmaf_public_var.shipping_address,modal:!0,autoOpen:!1,minHeight:400,maxHeight:600,width:780});return $("#thmaf_billing_alt").change(function(event){event.preventDefault();var select_type=this.value;"add_address"==select_type?add_new_address("","billing"):populate_selected_address("","billing",select_type)}),$("#thmaf_shipping_alt").change(function(event){event.preventDefault();var select_type=this.value;"add_address"==select_type?add_new_address("","shipping",event):populate_selected_address("","shipping",select_type)}),$("#ship-to-different-address-checkbox").change(function(){$("#ship-to-different-address-checkbox").is(":checked")?$("#thmaf_checkbox_shipping").val("ship_select"):$("#thmaf_checkbox_shipping").val(default_shipping)}),$("input.active_multi_ship").is(":checked")?$("#shipping_tiles").css("display","none"):$("#shipping_tiles").css("display","block"),{show_billing_popup:show_billing_popup,show_shipping_popup:show_shipping_popup,populate_selected_address:populate_selected_address,add_new_address:add_new_address,ship_to_multi_address:ship_to_multi_address,select_cart_mutlti_shipping:select_cart_mutlti_shipping,shipping_method_change:shipping_method_change,add_new_shipping_address_model:add_new_shipping_address_model,cart_save_address:cart_save_address,close_cart_add_adr_modal:close_cart_add_adr_modal}}(window.jQuery,window,document),thmaf_public_base=function($,window,document){"use strict";function display_char_count(elm,isCount){var fid=elm.prop("id"),len=elm.val().length,displayElm=$("#"+fid+"-char-count");if(isCount)displayElm.text("("+len+" characters)");else{var maxLen=elm.prop("maxlength"),left=maxLen-len;displayElm.text("("+left+" characters left)"),rem<0&&displayElm.css("color","red")}}function set_field_value_by_elm(elm,type,value){switch(type){case"radio":elm.val([value]);break;case"checkbox":1==elm.data("multiple")?(value=value||[],elm.val([value]).change()):elm.val([value]).change();break;case"select":if(1==thmaf_public_var.select_options){var option_values=[];elm.find("option").each(function(option_key,option_val){""!=$(this).val()&&(option_values[option_key]=$(this).val())}),-1!=$.inArray(value,option_values)?elm.prop("multiple")?elm.val(value):elm.val([value]).change():(elm.append($("<option></option>").attr("value",value).text(value)),elm.val([value]).change())}else elm.prop("multiple")?elm.val(value):elm.val([value]).change();break;case"multiselect":elm.prop("multiple")?void 0!==value&&elm.val(value.split(",")).change():elm.val([value]).change();break;case"hidden":break;default:elm.val(value).change()}}function thmaf_set_field_value_by_elm(elm,type,value){switch(type){case"radio":elm.prop("checked",!1);break;case"checkbox":1==elm.data("multiple")?(value=value||[],elm.prop("checked",!1)):elm.prop("checked",!1);break;case"select":if(1==thmaf_public_var.select_options){var option_values=[];elm.find("option").each(function(option_key,option_val){""!=$(this).val()&&(option_values[option_key]=$(this).val())}),-1!=$.inArray(value,option_values)?(elm.prop("multiple"),elm.val("")):(elm.append($("<option></option>").attr("value",value).text(value)),elm.val(""))}else elm.prop("multiple")?elm.val(""):(elm.val([value]).change(),$(".form-row.woocommerce-invalid .select2-selection").css({"border-color":"#aaa","border-width":"1px","border-style":"solid"}));break;case"multiselect":elm.prop("multiple")?void 0!==value&&elm.val(value.split(",")).val(""):elm.val("");break;case"hidden":break;case"email":elm.val(""),elm.attr("autocomplete","off");break;default:elm.val("")}elm.closest("p").removeClass("woocommerce-validated"),elm.closest("p").removeClass("woocommerce-invalid")}function get_field_value(type,elm,name){var value="";switch(type){case"radio":value=$("input[type=radio][name="+name+"]:checked").val();break;case"checkbox":if(1==elm.data("multiple")){var valueArr=[];$("input[type=checkbox][name='"+name+"[]']:checked").each(function(){valueArr.push($(this).val())}),value=valueArr}else value=$("input[type=checkbox][name="+name+"]:checked").val();break;case"select":case"multiselect":default:value=elm.val()}return value}return $.fn.getType=function(){try{return"INPUT"==this[0].tagName?this[0].type.toLowerCase():this[0].tagName.toLowerCase()}catch(err){return"E001"}},{display_char_count:display_char_count,set_field_value_by_elm:set_field_value_by_elm,thmaf_set_field_value_by_elm:thmaf_set_field_value_by_elm,get_field_value:get_field_value}}(window.jQuery,window,document);!function($){"use strict";!function(){$(".wrapper-class")}()}(jQuery); -
themehigh-multiple-addresses/trunk/public/class-thmaf-public-checkout.php
r3301317 r3378681 100 100 $cart_shipping = isset($_POST['cart_shipping']) ? $_POST['cart_shipping'] : ''; 101 101 $cart_shipping_data = self::thmaf_unserialize_form($cart_shipping); 102 $cfe_hide_field = isset($_POST['cfe_hide_field']) ? $_POST['cfe_hide_field'] : ''; 102 103 103 104 $country = isset($cart_shipping_data['shipping_country']) ? $cart_shipping_data['shipping_country'] : ''; … … 122 123 } 123 124 // Validate the form. 124 $true_check = self::validate_cart_shipping_addr_data($address_data, $cart_shipping_data );125 $true_check = self::validate_cart_shipping_addr_data($address_data, $cart_shipping_data,$cfe_hide_field); 125 126 $true_check_val = ''; 126 127 if($true_check == 'true') { … … 206 207 */ 207 208 208 public static function validate_cart_shipping_addr_data($address_data, $sipping_data ) {209 public static function validate_cart_shipping_addr_data($address_data, $sipping_data, $cfe_hide_field=array()) { 209 210 $true_check = array(); 210 211 $error_check = ''; 212 if (!is_array($cfe_hide_field)) { 213 $cfe_hide_field = array(); 214 } 211 215 212 216 if(!empty($address_data) && is_array($address_data)) { … … 219 223 // check is field is required and value is empty. 220 224 if (! empty($required) && empty($value)) { 221 $error_check .= esc_html__($dvalue['label'].' is a required field.', 'woocommerce'); 222 $error_check .= '</br>'; 223 $true_check[] = false; 225 if (!in_array($dkey, $cfe_hide_field)) { 226 $error_check .= esc_html__($dvalue['label'].' is a required field.', 'woocommerce'); 227 $error_check .= '</br>'; 228 $true_check[] = false; 229 } 224 230 } else { 225 231 $true_check[] = true; -
themehigh-multiple-addresses/trunk/public/class-thmaf-public.php
r3301317 r3378681 2595 2595 $product_id = $order_item->get_product_id(); 2596 2596 $product = wc_get_product( $product_id ); 2597 if(!$product) { 2598 return $formatted_meta; 2599 } 2597 2600 if (($product-> is_virtual('yes')) || ($product->is_downloadable('yes'))) { 2598 2601 return $formatted_meta; -
themehigh-multiple-addresses/trunk/readme.txt
r3301317 r3378681 5 5 Requires at least: 5.2 6 6 Tested up to: 6.8 7 Stable tag: 2. 2.97 Stable tag: 2.3.0 8 8 Requires PHP: 7.0.0 9 9 License: GPLv2 or later … … 276 276 277 277 == Changelog == 278 279 = 2.3.0 = 280 * Added WooCommerce 10.2 compatibility. 281 * Improved compatibility with [Checkout Field Editor for WooCommerce](https://www.themehigh.com/product/woocommerce-checkout-field-editor-pro/). 278 282 279 283 = 2.2.9 = -
themehigh-multiple-addresses/trunk/themehigh-multiple-addresses.php
r3301317 r3378681 4 4 * Plugin URI: https://www.themehigh.com/product/woocommerce-multiple-addresses-pro 5 5 * Description: Add and save multiple billing and shipping addresses. And enable the Multiple-shipping feature for a seamless shopping experience. 6 * Version: 2. 2.96 * Version: 2.3.0 7 7 * Author: ThemeHigh 8 8 * Author URI: https://www.themehigh.com/ 9 9 * Text Domain: themehigh-multiple-addresses 10 10 * Domain Path: /languages 11 * Requires Plugins: woocommerce 11 12 * WC requires at least: 3.0.0 12 * WC tested up to: 9.8 13 * WC tested up to: 10.2 14 * 13 15 */ 14 16 … … 36 38 if(is_woocommerce_active()) { 37 39 if(!check_pro_plugin_is_activated()) { 38 define('THMAF_VERSION', '2. 2.9');40 define('THMAF_VERSION', '2.3.0'); 39 41 !defined('THMAF_SOFTWARE_TITLE') && define('THMAF_SOFTWARE_TITLE', 'Woocommerce Multiple Addresses'); 40 42 !defined('THMAF_FILE') && define('THMAF_FILE', __FILE__);
Note: See TracChangeset
for help on using the changeset viewer.