Changeset 2936642
- Timestamp:
- 07/10/2023 04:09:23 PM (3 years ago)
- Location:
- ade-custom-shipping/trunk
- Files:
-
- 3 edited
-
README.md (modified) (2 diffs)
-
ade-custom-shipping.php (modified) (1 diff)
-
assets/js/wc-custom-checkout.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ade-custom-shipping/trunk/README.md
r2915089 r2936642 7 7 Requires PHP: 7.0 8 8 Tested up to: 6.2 9 Stable tag: 4. 0.99 Stable tag: 4.1.0 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 45 45 46 46 == Changelog == 47 48 = 4.1.0 = 49 50 Fix bugs 47 51 48 52 = 4.0.9 = -
ade-custom-shipping/trunk/ade-custom-shipping.php
r2915089 r2936642 7 7 * Author URI: https://adeleyeayodeji.com 8 8 * Description: Add shipping zones 3 levels deep for ecommerce. 9 * Version: 4. 0.99 * Version: 4.1.0 10 10 * License: GPL2 11 11 * License URL: http://www.gnu.org/licenses/gpl-2.0.txt -
ade-custom-shipping/trunk/assets/js/wc-custom-checkout.js
r2808775 r2936642 1 /** 2 * Ade Custom Shipping | adesetWooInputValues 3 * @package Ade Custom Shipping 4 */ 5 function adesetWooInputValues() { 6 jQuery(document).ready(function ($) { 7 //get the state 8 var state_select = $('select[name="billing_state"]'); 9 //if not exist 10 if (!state_select.length) { 11 return; 12 } 13 //get selected option 14 var selected_option = state_select.find("option:selected").val(); 15 //check if selected_option is not empty 16 if (selected_option == "") { 17 //do nothing 18 return; 19 } 20 //set value to input if exists 21 if (document.querySelector("#billing_city")) { 22 document.querySelector("#billing_city").value = selected_option; 23 } 24 //check if billing_city exists 25 if ( 26 document.querySelector('form[name="checkout"] input[name="billing_city"]') 27 ) { 28 document.querySelector( 29 'form[name="checkout"] input[name="billing_city"]' 30 ).value = selected_option; 31 } 32 //state 33 if ( 34 document.querySelector( 35 'form[name="checkout"] input[name="billing_state"]' 36 ) 37 ) { 38 document.querySelector( 39 'form[name="checkout"] input[name="billing_state"]' 40 ).value = selected_option; 41 //custom 42 } 43 }); 44 } 45 1 46 function adesetValue2(elem) { 2 47 jQuery(document).ready(function ($) { … … 16 61 } 17 62 }); 18 //get selected option 19 var selected_option = $('select[name="billing_state"]') 20 .find("option:selected") 21 .val(); 22 document.querySelector("#billing_city").value = selected_option; 23 //form name="checkout" input name billing_city 24 //custom 25 document.querySelector( 26 'form[name="checkout"] input[name="billing_city"]' 27 ).value = selected_option; 28 //state 29 if ( 30 document.querySelector( 31 'form[name="checkout"] input[name="billing_state"]' 32 ) 33 ) { 34 document.querySelector( 35 'form[name="checkout"] input[name="billing_state"]' 36 ).value = selected_option; 37 //custom 38 } 63 //update selected option 64 adesetWooInputValues(); 39 65 $(document.body).trigger("update_checkout"); 40 66 }); … … 156 182 do_ade_calculation(state, lga); 157 183 } 184 adesetWooInputValues(); 158 185 }, 1000); 159 186 });
Note: See TracChangeset
for help on using the changeset viewer.