PageSourceSearch

https://mystrom.com/wp-content/themes/mystrom-com/js/WooCommerceCheckoutDataHelper.js?ver=1642668305

js mystrom.com collected 2026-10-07 02:47:02 UTC 2,292 bytes, 72 lines download raw bytes

1;(function($, window, document, undefined) {
2	var $win = $(window);
3	var $doc = $(document);
4
5	WooCommerceCheckoutDataHelper = {};
6	WooCommerceCheckoutDataHelper.formsWrapper = '';
7	WooCommerceCheckoutDataHelper.fields = {};
8
9	WooCommerceCheckoutDataHelper.initialize = function() {
10		var _this = this;
11		_this.formsWrapper = $( 'form.woocommerce-checkout' );
12
13		_this.fields = {
14			'shipping_first_name' : 'billing_first_name',
15			'shipping_last_name' : 'billing_last_name',
16			'shipping_company' : 'billing_company',
17			'shipping_address_1' : 'billing_address_1',
18			'shipping_address_2' : 'billing_address_2',
19			'shipping_postcode' : 'billing_postcode',
20			'shipping_city' : 'billing_city',
21			'shipping_state' : 'billing_state',
22		};
23
24		_this.dataPopulation();
25	}
26
27	WooCommerceCheckoutDataHelper.dataPopulation = function() {
28		var _this = this;
29		var fieldsObject = _this.fields;
30
31		if ( ! fieldsObject ) {
32			return false;
33		}
34
35		$doc.on( 'click', 'form.woocommerce-checkout .btn-copy', function(event) {
36			event.preventDefault();
37
38			for ( shippingFieldName in fieldsObject ) {
39				var billingFieldName = fieldsObject[ shippingFieldName ];
40
41				var $shippingField = $( 'input[name="' + shippingFieldName + '"]' );
42				var $billingField = $( 'input[name="' + billingFieldName + '"]' );
43				if ( ! $shippingField.length || ! $billingField.length ) {
44					continue;
45				}
46
47				var shippingFieldValue = $shippingField.val();
48				$billingField
49					.val( shippingFieldValue )
50					.parent()
51					.removeClass( 'woocommerce-invalid woocommerce-invalid-required-field' );
52			}
53
54			var $shippingCountry = $('select[name="shipping_country"]');
55			var $billingCountry  = $('select[name="billing_country"]');
56
57			if ( $shippingCountry.length || $billingCountry.length ) {
58				var shippingCountryValue = $shippingCountry.val();
59
60				$billingCountry
61					.val( shippingCountryValue )
62					.parent()
63					.removeClass( 'woocommerce-invalid woocommerce-invalid-required-field' );
64
65				$('#select2-billing_country-container').text( $billingCountry.find('option[value="' + shippingCountryValue + '"]').text() );
66			}
67		} );
68	}
69
70	window.WooCommerceCheckoutDataHelper = WooCommerceCheckoutDataHelper;
71
72})(jQuery, window, document);

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.