1(function ($) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 31 */ 32 33})(jQuery); 34 35jQuery(document).ready(function () { 36 jQuery('body').on('change', 'input[name="payment_method"]', function () { 37 jQuery('body').trigger('update_checkout'); 38 }); 39}); 40 41jQuery(window).on('load', function () { 42 if (jQuery('.forceall_shipping_method').length) { 43 if (jQuery('.forceall_shipping_method').is(':hidden')) { 44 updateCartButton(); 45 } 46 } 47 48 function updateCartButton() { 49 jQuery('.forceall_shipping_method').attr('checked', true).trigger('change'); 50 var checked = jQuery('.forceall_shipping_method').is(':checked'); 51 if (checked == 'true') { 52 jQuery('[name=\'update_cart\']').trigger('click'); 53 } 54 } 55 function update_quantity() { 56 // Fires whenever variation selects are changed 57 var min_qty = jQuery('.quantity .input-text.qty.text').attr('min'); 58 if ('' != min_qty) { 59 jQuery('.quantity .input-text.qty.text').val(min_qty); 60 } 61 } 62 jQuery('.variations_form').on('woocommerce_variation_select_change', function () { 63 setTimeout(update_quantity, 200) 64 }); 65}); 66
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.