Code copy shipping address tới billing address woocommerce, lưu ở đây anh chị nào cần thì copy xài nhé
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
var inputBoxTypes = "input, select, textarea"; var shippingLength = "shipping_".length; // Add in hack to override val function to make it work properly with addons (such as saved addresses) var originalVal = $.fn.val; $.fn.val = function(){ var result = originalVal.apply(this,arguments); if(arguments.length > 0 && $(this).attr("id") && $(this).attr("id").indexOf("shipping_") === 0) { $(this).change(); // OR with custom event $(this).trigger('value-changed'); } return result; }; // For every kind of input on the shipping side of things, try and // keep in sync with billing $(inputBoxTypes, ".woocommerce-shipping-fields__field-wrapper").on("change keyup update", function () { if (!$("#bill-to-different-address-checkbox").prop('checked')) { // Update the value on the billing side $("#billing_" + $(this).attr("id").substr(shippingLength)).val($(this).val()); } }).trigger('change'); |
Mọi sự sao chép xin ghi rõ nguồn là fcwordpress.net
Chuyên trang về wordpress: hướng dẫn thiết kế theme, plugin, thủ thuật wordpress