PageSourceSearch

https://www.minisrael.co.il/wp-content/plugins/cartflows-pro/assets/js/checkout.js?ver=1.9.1

js minisrael.co.il collected 2026-10-02 10:03:23 UTC 42,177 bytes, 1,540 lines download raw bytes

1( function ( $ ) {
2	const wcf_page_title_notification = {
3		vars: {
4			originalTitle: document.title,
5			interval: null,
6		},
7		On( notification, intervalSpeed ) {
8			const _this = this;
9			_this.vars.interval = setInterval(
10				function () {
11					document.title =
12						_this.vars.originalTitle === document.title
13							? notification
14							: _this.vars.originalTitle;
15				},
16				intervalSpeed ? intervalSpeed : 1000
17			);
18		},
19		Off() {
20			clearInterval( this.vars.interval );
21			document.title = this.vars.originalTitle;
22		},
23	};
24
25	const wcf_update_product_options_cart_item_key = function () {
26		$( document ).on(
27			'wcf_cart_data_restored',
28			function ( e, wcf_cart_data ) {
29				if ( 'yes' === cartflows.is_product_options && wcf_cart_data ) {
30					$( '.wcf-qty-row' ).each( function () {
31						const product_data = $( this ).data( 'options' );
32						if ( product_data ) {
33							if ( product_data.unique_id in wcf_cart_data ) {
34								product_data.cart_item_key =
35									wcf_cart_data[ product_data.unique_id ];
36								$( this ).attr(
37									'data-options',
38									JSON.stringify( product_data )
39								);
40							}
41						}
42					} );
43				}
44			}
45		);
46	};
47
48	const wcf_animate_browser_tab = function () {
49		if ( 'yes' !== cartflows_animate_tab_fields.enabled ) {
50			return;
51		}
52
53		$( window ).blur( function () {
54			wcf_page_title_notification.On(
55				cartflows_animate_tab_fields.title
56			);
57		} );
58
59		$( window ).on( 'focus', function () {
60			wcf_page_title_notification.Off();
61		} );
62	};
63
64	// Scroll to top for the two step navigation.
65	const wcf_scroll_to_top = function ( scrollTo ) {
66		if ( scrollTo.length ) {
67			event.preventDefault();
68			$( 'html, body' )
69				.stop()
70				.animate(
71					{
72						scrollTop: scrollTo.offset().top - 50,
73					},
74					100
75				);
76		}
77	};
78
79	const wcf_display_spinner = function () {
80		$(
81			'.woocommerce-checkout-review-order-table, .wcf-product-option-wrap, .wcf-bump-order-wrap'
82		).block( {
83			message: null,
84			overlayCSS: {
85				background: '#fff',
86				opacity: 0.6,
87			},
88		} );
89	};
90
91	const wcf_remove_spinner = function ( rsp ) {
92		if( ! cartflows.wcf_refresh_checkout ){
93			if ( jQuery( '.wc_payment_methods' ).length ) {
94				if ( rsp.hasOwnProperty( 'cart_total' ) ) {
95					// Update the Fragements for order bump & product options add/remove.
96					if ( rsp.hasOwnProperty( 'fragments' ) ) {
97						$.each( rsp.fragments, function ( key, value ) {
98							// Update the Fragments for place order button to update the cart price displayed on button.
99							if ( '#place_order' === key ) {
100								const selected_payment_gateway = $(
101									".wc_payment_methods input[name='payment_method']:checked"
102								);
103								if ( selected_payment_gateway.length > 0 ) {
104									$( key ).replaceWith( value );
105									selected_payment_gateway.trigger( 'click' );
106								}
107							} else {
108								$( key ).replaceWith( value );
109							}
110						} );
111					}
112
113					if ( parseFloat( rsp.cart_total ) > 0 ) {
114						$(
115							'.woocommerce-checkout-review-order-table, .wcf-product-option-wrap, .wcf-bump-order-wrap'
116						).unblock();
117					} else {
118						$( 'body' ).trigger( 'update_checkout' );
119						$(
120							'.woocommerce-checkout-review-order-table, .wcf-product-option-wrap, .wcf-bump-order-wrap'
121						).unblock();
122					}
123				}
124			} else {
125				$( 'body' ).trigger( 'update_checkout' );
126				$(
127					'.woocommerce-checkout-review-order-table, .wcf-product-option-wrap, .wcf-bump-order-wrap'
128				).unblock();
129			}
130		}else{
131			$( 'body' ).trigger( 'update_checkout' );
132			$(
133				'.woocommerce-checkout-review-order-table, .wcf-product-option-wrap, .wcf-bump-order-wrap'
134			).unblock();
135		}
136	};
137
138	const wcf_product_quantity_var_options = function () {
139		const wcf_variation_validation_trigger_click = function () {
140			$( 'form.woocommerce-checkout' ).on(
141				'checkout_place_order',
142				function ( e ) {
143					const invalid_var = $(
144						'.wcf-select-variation-attribute.wcf-invalid-variation'
145					);
146
147					if ( invalid_var.length > 0 ) {
148						e.preventDefault();
149						wcf_scroll_to_top( invalid_var );
150						return ! 1;
151					}
152				}
153			);
154
155			$( '.wcf-select-variation-attribute' ).on( 'click', function ( e ) {
156				e.preventDefault();
157
158				const wrap = $( this ).closest( '.wcf-qty-row' );
159
160				wrap.find( '.wcf-item-choose-options a' ).trigger( 'click' );
161			} );
162		};
163
164		$( '.wcf-qty-row' ).on( 'click', function ( event ) {
165			if (
166				$( event.target ).is(
167					'.wcf-multiple-sel, .wcf-single-sel, .wcf-qty, .wcf-qty-selection, .wcf-variable-item-popup-text, .wcf-qty-selection-btn, .wcf-qty-increment-icon, .wcf-qty-decrement-icon'
168				)
169			) {
170				return;
171			}
172
173			const single_selection = $( this ).find( '.wcf-single-sel' ),
174				multiple_selection = $( this ).find( '.wcf-multiple-sel' );
175
176			if ( single_selection.length > 0 ) {
177				single_selection.trigger( 'click' );
178			} else if ( multiple_selection.length > 0 ) {
179				multiple_selection.trigger( 'click' );
180			}
181		} );
182
183		/* Single Selection */
184		$( document ).on( 'change', '.wcf-single-sel', function () {
185			const $this = $( this );
186			const wrapper = $this.closest( '.wcf-qty-options' );
187			const wrap = $this.closest( '.wcf-qty-row' );
188			const option = wrap.data( 'options' );
189			const input = wrap.find( '.wcf-qty input' );
190			let input_quantity = parseInt( input.val() );
191			const checkout_id = $( '._wcf_checkout_id' ).val();
192
193			if ( 0 >= input_quantity || isNaN( input_quantity ) ) {
194				input.val( 1 );
195				input_quantity = 1;
196			}
197
198			option.input_quantity = input_quantity;
199			option.checkout_id = checkout_id;
200
201			const post_data = $( 'form.checkout' ).serialize();
202
203			wcf_display_spinner();
204			wrapper.addClass( 'wcf-loading' );
205			$.ajax( {
206				url: cartflows.ajax_url,
207				data: {
208					action: 'wcf_single_selection',
209					option,
210					post_data,
211					security: cartflows.wcf_single_selection_nonce,
212				},
213				dataType: 'json',
214				type: 'POST',
215				success( response ) {
216					if ( response.hasOwnProperty( 'cartflows_data' ) ) {
217						wrap.find( '.wcf-display-quantity' ).html(
218							response.cartflows_data.display_quantity
219						);
220						wrap.find( '.wcf-display-price' ).html(
221							response.cartflows_data.display_price
222						);
223						wrap.find( '.wcf-display-discount-value' ).html(
224							response.cartflows_data.display_discount_value
225						);
226						wrap.find( '.wcf-display-discount-percent' ).html(
227							response.cartflows_data.display_discount_percent
228						);
229
230						wrap.find( '.wcf_subscription_price' ).html(
231							response.cartflows_data.subscription_price
232						);
233						wrap.find( '.wcf_subscription_fee' ).html(
234							response.cartflows_data.sign_up_fee
235						);
236						console.log( response );
237					}
238
239					wcf_remove_spinner( response );
240					wrapper.removeClass( 'wcf-loading' );
241					option.cart_item_key = response.cart_item_key;
242					wrap.attr( 'data-options', JSON.stringify( option ) );
243
244					// Re-calculate the cart total
245					$( document.body ).trigger( 'updated_cart_totals' );
246				},
247				error() {
248					$( '.woocommerce-checkout-review-order-table' ).unblock();
249				},
250			} );
251		} );
252
253		/* Multiple Selection */
254		$( document ).on( 'change', '.wcf-multiple-sel', function () {
255			const checked_cb = $( '.wcf-multiple-sel:checked' );
256			const $this = $( this );
257			const wrap = $this.closest( '.wcf-qty-row' );
258
259			const input = wrap.find( '.wcf-qty input' );
260			let input_quantity = parseInt( input.val() );
261
262			if ( 0 >= input_quantity || isNaN( input_quantity ) ) {
263				input.val( 1 );
264				input_quantity = 1;
265			}
266
267			if ( 0 === checked_cb.length ) {
268				$this.prop( 'checked', true );
269				$this.prop( 'disabled', true );
270				return;
271			}
272
273			if ( 1 === checked_cb.length ) {
274				checked_cb.prop( 'disabled', true );
275			} else {
276				checked_cb.removeAttr( 'disabled' );
277			}
278
279			const option = wrap.data( 'options' );
280			const checkout_id = $( '._wcf_checkout_id' ).val();
281			option.checkout_id = checkout_id;
282			option.input_quantity = input_quantity;
283			option.checked = 'no';
284			const post_data = $( 'form.checkout' ).serialize();
285
286			if ( $this.is( ':checked' ) ) {
287				option.checked = 'yes';
288			}
289
290			wcf_display_spinner();
291			$( '.wcf-qty-options' ).addClass( 'wcf-loading' );
292			$.ajax( {
293				url: cartflows.ajax_url,
294				data: {
295					action: 'wcf_multiple_selection',
296					option,
297					post_data,
298					security: cartflows.wcf_multiple_selection_nonce,
299				},
300				dataType: 'json',
301				type: 'POST',
302				success( response ) {
303					if ( response.hasOwnProperty( 'cartflows_data' ) ) {
304						wrap.find( '.wcf-display-quantity' ).html(
305							response.cartflows_data.display_quantity
306						);
307						wrap.find( '.wcf-display-price' ).html(
308							response.cartflows_data.display_price
309						);
310						wrap.find( '.wcf-display-discount-value' ).html(
311							response.cartflows_data.display_discount_value
312						);
313						wrap.find( '.wcf-display-discount-percent' ).html(
314							response.cartflows_data.display_discount_percent
315						);
316
317						wrap.find( '.wcf_subscription_price' ).html(
318							response.cartflows_data.subscription_price
319						);
320						wrap.find( '.wcf_subscription_fee' ).html(
321							response.cartflows_data.sign_up_fee
322						);
323					}
324
325					wcf_remove_spinner( response );
326					$( '.wcf-qty-options' ).removeClass( 'wcf-loading' );
327					option.cart_item_key = response.cart_item_key;
328					wrap.attr( 'data-options', JSON.stringify( option ) );
329
330					// Re-calculate the cart total
331					$( document.body ).trigger( 'updated_cart_totals' );
332				},
333				error() {
334					$( '.woocommerce-checkout-review-order-table' ).unblock();
335				},
336			} );
337		} );
338
339		/* Force All Selection */
340		$( document ).on( 'change', '.wcf-var-sel', function () {
341			const $this = $( this );
342			const wrap = $this.closest( '.wcf-qty-row' );
343			const input = wrap.find( '.wcf-qty input' );
344			const option = wrap.data( 'options' );
345			const input_quantity = parseInt( input.val() );
346			const checkout_id = $( '._wcf_checkout_id' ).val();
347
348			option.checkout_id = checkout_id;
349			option.input_quantity = input_quantity;
350
351			wcf_display_spinner();
352			$( '.wcf-qty-options' ).addClass( 'wcf-loading' );
353			$.ajax( {
354				url: cartflows.ajax_url,
355				data: {
356					action: 'wcf_variation_selection',
357					option,
358					security: cartflows.wcf_variation_selection_nonce,
359				},
360				dataType: 'json',
361				type: 'POST',
362				success( response ) {
363					if ( response.hasOwnProperty( 'cartflows_data' ) ) {
364						wrap.find( '.wcf-display-quantity' ).html(
365							response.cartflows_data.display_quantity
366						);
367						wrap.find( '.wcf-display-price' ).html(
368							response.cartflows_data.display_price
369						);
370						wrap.find( '.wcf-display-discount-value' ).html(
371							response.cartflows_data.display_discount_value
372						);
373						wrap.find( '.wcf-display-discount-percent' ).html(
374							response.cartflows_data.display_discount_percent
375						);
376
377						wrap.find( '.wcf_subscription_price' ).html(
378							response.cartflows_data.subscription_price
379						);
380						wrap.find( '.wcf_subscription_fee' ).html(
381							response.cartflows_data.sign_up_fee
382						);
383					}
384
385					wcf_remove_spinner( response );
386					$( '.wcf-qty-options' ).removeClass( 'wcf-loading' );
387					// Re-calculate the cart total
388					$( document.body ).trigger( 'updated_cart_totals' );
389				},
390				error() {
391					$( '.woocommerce-checkout-review-order-table' ).unblock();
392				},
393			} );
394		} );
395
396		/* Quantity Selection For All type */
397		$( document ).on( 'change', '.wcf-qty-selection', function () {
398			const $this = $( this ),
399				wrap = $this.closest( '.wcf-qty-row' ),
400				item_selector = wrap.find( '.wcf-item-selector' );
401
402			if ( item_selector.length > 0 ) {
403				const selector_input = item_selector.find( 'input' );
404
405				if (
406					selector_input.length > 0 &&
407					! selector_input.is( ':checked' )
408				) {
409					return;
410				}
411			}
412
413			const option = wrap.data( 'options' ),
414				checkout_id = $( '._wcf_checkout_id' ).val();
415
416			let input_quantity = parseInt( $this.val() );
417			if ( 0 >= input_quantity || isNaN( input_quantity ) ) {
418				$this.val( 1 );
419				input_quantity = 1;
420			}
421
422			option.input_quantity = input_quantity;
423			option.checkout_id = checkout_id;
424			const post_data = $( 'form.checkout' ).serialize();
425
426			if ( typeof data !== 'undefined' ) {
427				option.cart_item_key = data.cart_item_key;
428			}
429
430			wcf_display_spinner();
431
432			$( '.wcf-qty-options' ).addClass( 'wcf-loading' );
433
434			$.ajax( {
435				url: cartflows.ajax_url,
436				data: {
437					action: 'wcf_quantity_update',
438					option,
439					post_data,
440					security: cartflows.wcf_quantity_update_nonce,
441				},
442				dataType: 'json',
443				type: 'POST',
444				success( response ) {
445					if ( response.hasOwnProperty( 'cartflows_data' ) ) {
446						wrap.find( '.wcf-display-quantity' ).html(
447							response.cartflows_data.display_quantity
448						);
449						wrap.find( '.wcf-display-price' ).html(
450							response.cartflows_data.display_price
451						);
452						wrap.find( '.wcf-display-discount-value' ).html(
453							response.cartflows_data.display_discount_value
454						);
455						wrap.find( '.wcf-display-discount-percent' ).html(
456							response.cartflows_data.display_discount_percent
457						);
458
459						wrap.find( '.wcf_subscription_price' ).html(
460							response.cartflows_data.subscription_price
461						);
462						wrap.find( '.wcf_subscription_fee' ).html(
463							response.cartflows_data.sign_up_fee
464						);
465					}
466
467					wcf_remove_spinner( response );
468					$( '.wcf-qty-options' ).removeClass( 'wcf-loading' );
469					// Re-calculate the cart total
470					$( document.body ).trigger( 'updated_cart_totals' );
471				},
472				error() {
473					$( '.woocommerce-checkout-review-order-table' ).unblock();
474				},
475			} );
476		} );
477
478		/* Variation attribute and click trigger */
479		wcf_variation_validation_trigger_click();
480
481		/* Variation Popup */
482		wcf_quick_view();
483	};
484
485	const wcf_do_not_remove_single_product = function () {
486		const checked_cb = $( '.wcf-multiple-sel:checked' );
487
488		if ( 1 === checked_cb.length ) {
489			checked_cb.prop( 'checked', true );
490			checked_cb.prop( 'disabled', true );
491		}
492	};
493
494	const wcf_remove_product = function () {
495		$( document ).on( 'cartflows_remove_product', function ( e, p_id ) {
496			jQuery( '.wcf-multiple-sel[value="' + p_id + '"]' ).prop(
497				'checked',
498				false
499			);
500			jQuery( '.wcf-single-sel[value="' + p_id + '"]' ).prop(
501				'checked',
502				false
503			);
504		} );
505	};
506
507	const wcf_order_bump_ajax = function () {
508		let wcf_order_bump_clicked = false;
509
510		$( document ).on( 'change', '.wcf-bump-order-cb', function () {
511			if ( true === wcf_order_bump_clicked ) {
512				return false;
513			}
514
515			wcf_order_bump_clicked = true;
516
517			const $this = $( this );
518			const product_id = $this.data( 'ob_data' ).product_id;
519			const checkout_id = $( '[name=_wcf_checkout_id]' ).val();
520			const bump_offer_data = $this.attr( 'data-ob_data' ),
521				ob_id = $this.data( 'ob_data' ).ob_id;
522
523			const button_class = $this
524				.closest( '.wcf-bump-order-field-wrap' )
525				.find( '.wcf-bump-order-cb-button' );
526			const bump_offer_wrap = $this.closest( '.wcf-bump-order-wrap' );
527
528			let is_add_to_cart = '';
529
530			const data = {
531				security: cartflows.wcf_bump_order_process_nonce,
532				_wcf_checkout_id: checkout_id,
533				_wcf_product_id: product_id,
534				_bump_offer_data: bump_offer_data ? bump_offer_data : '',
535				action: 'wcf_bump_order_process',
536			};
537
538			let bump_product_ids = $( '[name=_wcf_bump_products]' ).val();
539
540			if ( '' === bump_product_ids ) {
541				bump_product_ids = {};
542			} else {
543				bump_product_ids = JSON.parse( bump_product_ids );
544			}
545
546			if ( $this.is( ':checked' ) ) {
547				data._wcf_bump_product_action = 'add_bump_product';
548				is_add_to_cart = true;
549			} else {
550				data._wcf_bump_product_action = 'remove_bump_product';
551				is_add_to_cart = false;
552			}
553
554			// Display spinner for specific order bump.
555			bump_offer_wrap.block( {
556				message: null,
557				overlayCSS: {
558					background: '#fff',
559					opacity: 0.6,
560				},
561			} );
562
563			$.ajax( {
564				url: cartflows.ajax_url,
565				data,
566				dataType: 'json',
567				type: 'POST',
568				success( response ) {
569					wcf_remove_spinner( response );
570					if ( button_class.length > 0 ) {
571						if ( is_add_to_cart ) {
572							button_class.toggleClass(
573								'wcf-bump-add-to-cart wcf-bump-remove-from-cart'
574							);
575							button_class.text( $this.data( 'remove' ) );
576						} else {
577							button_class.toggleClass(
578								'wcf-bump-remove-from-cart wcf-bump-add-to-cart'
579							);
580							button_class.text( $this.data( 'add' ) );
581						}
582					}
583
584					if ( $this.is( ':checked' ) ) {
585						bump_product_ids[ ob_id ] = {
586							id: product_id,
587							price: response.cartflows_data.total_product_price,
588						};
589					} else {
590						delete bump_product_ids[ ob_id ];
591					}
592					$( '[name=_wcf_bump_products]' ).val(
593						JSON.stringify( bump_product_ids )
594					);
595				},
596				error() {
597					$( '.woocommerce-checkout-review-order-table' ).unblock();
598				},
599			} );
600
601			wcf_order_bump_clicked = false;
602
603			return false;
604		} );
605	};
606
607	const wcf_nav_tab_hide_show_events = function () {
608		/* Ready */
609		wcf_nav_tab_hide_show();
610
611		$( '.wcf-embed-checkout-form-two-step .woocommerce' ).addClass(
612			'step-one'
613		);
614
615		/* Change Custom Field*/
616		$(
617			'.wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-steps a'
618		).on( 'click', function ( e ) {
619			e.preventDefault();
620			wcf_nav_tab_hide_show();
621		} );
622
623		/* Change on click of next button */
624		$(
625			'.wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-nav-btns a'
626		).on( 'click', function ( e ) {
627			e.preventDefault();
628
629			// Check form validation before go to step two.
630
631			wcf_nav_tab_hide_show_next_btn();
632		} );
633	};
634
635	const wcf_nav_tab_hide_show_next_btn = function () {
636		if ( wcf_two_step_validations() ) {
637			$(
638				'.wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-steps div.wcf-current'
639			).removeClass( 'wcf-current' );
640
641			const selector = $(
642				'.wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-nav-btns a'
643			).attr( 'href' );
644
645			if ( selector === '#customer_details' ) {
646				wcf_scroll_to_top( $( '.wcf-embed-checkout-form-nav' ) );
647				$(
648					'.wcf-embed-checkout-form-two-step .woocommerce'
649				).removeClass( 'step-two' );
650				$( '.wcf-embed-checkout-form-two-step .woocommerce' ).addClass(
651					'step-one'
652				);
653				$( '.wcf-embed-checkout-form-two-step' )
654					.find( '.step-one' )
655					.addClass( 'wcf-current' );
656			} else if ( selector === '#wcf-order-wrap' ) {
657				wcf_scroll_to_top( $( '.wcf-embed-checkout-form-nav' ) );
658				$(
659					'.wcf-embed-checkout-form-two-step .woocommerce'
660				).removeClass( 'step-one' );
661				$( '.wcf-embed-checkout-form-two-step .woocommerce' ).addClass(
662					'step-two'
663				);
664				$( '.wcf-embed-checkout-form-two-step' )
665					.find( '.step-two' )
666					.addClass( 'wcf-current' );
667			}
668		}
669	};
670
671	const wcf_nav_tab_hide_show = function () {
672		$(
673			'.wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-steps a'
674		).on( 'click', function ( e ) {
675			e.preventDefault();
676
677			// Check form validation before go to step two.
678			// if ( $("div").hasClass("wcf-embed-checkout-form-two-step") && ! $('form[name="checkout"]').valid() ) {
679			// 	return false;
680			// }
681
682			if ( wcf_two_step_validations() ) {
683				const $this = $( this ),
684					wrap = $this.closest(
685						'.wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-steps div'
686					);
687				// 	validated = wcf_woocommerce_field_validate();
688
689				// if(validated === false){
690				// 	return false;
691				// }
692
693				$(
694					'.wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-steps div.wcf-current'
695				).removeClass( 'wcf-current' );
696
697				wrap.addClass( 'wcf-current' );
698
699				const selector = $this
700					.closest(
701						'.wcf-embed-checkout-form-two-step .wcf-embed-checkout-form-steps div a'
702					)
703					.attr( 'href' );
704				if ( selector === '#customer_details' ) {
705					$(
706						'.wcf-embed-checkout-form-two-step .woocommerce'
707					).removeClass( 'step-two' );
708					$(
709						'.wcf-embed-checkout-form-two-step .woocommerce'
710					).addClass( 'step-one' );
711				} else if ( selector === '#wcf-order-wrap' ) {
712					$(
713						'.wcf-embed-checkout-form-two-step .woocommerce'
714					).removeClass( 'step-one' );
715					$(
716						'.wcf-embed-checkout-form-two-step .woocommerce'
717					).addClass( 'step-two' );
718				}
719			}
720		} );
721	};
722
723	/* Autocomplete Zip Code */
724	const wcf_autocomplete_zip_data = function () {
725		let zip_code_timeout;
726
727		$( document.body ).on(
728			'textInput input change keypress paste',
729			'#billing_postcode, #shipping_postcode',
730			function () {
731				const $this = $( this ),
732					type = $this.attr( 'id' ).split( '_' )[ 0 ],
733					country = $( '#' + type + '_country' ).val();
734
735				if ( '' === country ) {
736					return;
737				}
738
739				const zip_code = $this.val().trim();
740				if ( '' === zip_code ) {
741					return;
742				}
743
744				clearTimeout( zip_code_timeout );
745
746				zip_code_timeout = setTimeout( function () {
747					if ( -1 === [ 'GB', 'CA' ].indexOf( country ) ) {
748						get_zip_data_and_update( type, country, zip_code );
749					}
750				}, 800 );
751			}
752		);
753
754		const get_zip_data_and_update = function ( type, country, zip_code ) {
755			$.ajax( {
756				url: 'https://api.zippopotam.us/' + country + '/' + zip_code,
757				cache: ! 0,
758				dataType: 'json',
759				type: 'GET',
760				success( result ) {
761					$.each( result.places, function () {
762						$( '#' + type + '_city' )
763							.val( this[ 'place name' ] )
764							.trigger( 'change' );
765						$( '[name="' + type + '_state"]:visible' )
766							.val( this[ 'state abbreviation' ] )
767							.trigger( 'change' );
768						return false;
769					} );
770				},
771				error() {},
772			} );
773		};
774	};
775
776	/**
777	 * Quick View
778	 */
779	const wcf_quick_view = function () {
780		const quick_view_btn = $( '.wcf-item-choose-options a' );
781
782		const modal_wrap = $( '.wcf-quick-view-wrapper' );
783
784		modal_wrap.appendTo( document.body );
785
786		const wcf_quick_view_bg = modal_wrap.find( '.wcf-quick-view-bg' ),
787			wcf_qv_modal = modal_wrap.find( '#wcf-quick-view-modal' ),
788			wcf_qv_content = wcf_qv_modal.find( '#wcf-quick-view-content' ),
789			wcf_qv_close_btn = wcf_qv_modal.find( '#wcf-quick-view-close' ),
790			wcf_qv_wrapper = wcf_qv_modal.find( '.wcf-content-main-wrapper' );
791
792		quick_view_btn.off( 'click' ).on( 'click', function ( e ) {
793			e.preventDefault();
794
795			const $this = $( this );
796
797			/* Check if product is selected */
798			const cls_wrap = $this.closest( '.wcf-item' );
799
800			if (
801				! cls_wrap.find( '.wcf-item-selector input' ).is( ':checked' )
802			) {
803				cls_wrap.find( '.wcf-item-selector input' ).trigger( 'click' );
804			}
805
806			const product_id = $this.data( 'product' );
807
808			$this.addClass( 'wcf-variation-popup-open' );
809
810			if ( ! wcf_qv_modal.hasClass( 'loading' ) ) {
811				wcf_qv_modal.addClass( 'loading' );
812			}
813
814			if ( ! wcf_quick_view_bg.hasClass( 'wcf-quick-view-bg-ready' ) ) {
815				wcf_quick_view_bg.addClass( 'wcf-quick-view-bg-ready' );
816			}
817
818			$( document ).trigger( 'wcf_quick_view_loading' );
819
820			wcf_qv_ajax_call( $this, product_id );
821		} );
822
823		const wcf_qv_ajax_call = function ( t, product_id ) {
824			wcf_qv_modal.css( 'opacity', 0 );
825
826			$.ajax( {
827				url: cartflows.ajax_url,
828				data: {
829					action: 'wcf_woo_quick_view',
830					product_id,
831				},
832				dataType: 'html',
833				type: 'POST',
834				success( data ) {
835					wcf_qv_content.html( data );
836					wcf_qv_content_height();
837				},
838			} );
839		};
840
841		const wcf_qv_content_height = function () {
842			// Variation Form
843			const form_variation = wcf_qv_content.find( '.variations_form' );
844
845			form_variation.trigger( 'check_variations' );
846			form_variation.trigger( 'reset_image' );
847
848			if ( ! wcf_qv_modal.hasClass( 'open' ) ) {
849				wcf_qv_modal.removeClass( 'loading' ).addClass( 'open' );
850
851				const scrollbar_width = wcf_get_scrollbar_width();
852				const $html = $( 'html' );
853
854				$html.css( 'margin-right', scrollbar_width );
855				$html.addClass( 'wcf-quick-view-is-open' );
856			}
857
858			if (
859				form_variation.length > 0 &&
860				'function' === typeof form_variation.wc_variation_form
861			) {
862				form_variation.wc_variation_form();
863				form_variation.find( 'select' ).trigger( 'change' );
864			}
865
866			/*wcf_qv_content.imagesLoaded( function(e) {
867
868				var image_slider_wrap = wcf_qv_modal.find('.wcf-qv-image-slider');
869
870				if ( image_slider_wrap.find('li').length > 1 ) {
871					image_slider_wrap.flexslider({
872						animation: "slide",
873						start: function( slider ){
874							setTimeout(function() {
875								wcf_update_summary_height( true );
876							}, 300);
877						},
878					});
879				}else{
880					setTimeout(function() {
881						wcf_update_summary_height( true );
882					}, 300);
883				}
884			});*/
885
886			const image_slider_wrap = wcf_qv_modal.find(
887				'.wcf-qv-image-slider'
888			);
889
890			if ( image_slider_wrap.find( 'li' ).length > 1 ) {
891				image_slider_wrap.flexslider( {
892					animation: 'slide',
893					start() {
894						setTimeout( function () {
895							wcf_update_summary_height( true );
896						}, 300 );
897					},
898				} );
899			} else {
900				setTimeout( function () {
901					wcf_update_summary_height( true );
902				}, 300 );
903			}
904
905			// stop loader
906			$( document ).trigger( 'wcf_quick_view_loader_stop' );
907		};
908
909		const wcf_qv_close_modal = function () {
910			// Close box by click overlay
911			wcf_qv_wrapper.on( 'click', function ( e ) {
912				if ( this === e.target ) {
913					wcf_qv_close();
914				}
915			} );
916
917			// Close box with esc key
918			$( document ).on( 'keyup', function ( e ) {
919				if ( e.keyCode === 27 ) {
920					wcf_qv_close();
921				}
922			} );
923
924			// Close box by click close button
925			wcf_qv_close_btn.on( 'click', function ( e ) {
926				e.preventDefault();
927				wcf_qv_close();
928			} );
929
930			const wcf_qv_close = function () {
931				wcf_quick_view_bg.removeClass( 'wcf-quick-view-bg-ready' );
932				wcf_qv_modal.removeClass( 'open' ).removeClass( 'loading' );
933				$( 'html' ).removeClass( 'wcf-quick-view-is-open' );
934				$( 'html' ).css( 'margin-right', '' );
935
936				quick_view_btn.removeClass( 'wcf-variation-popup-open' );
937
938				setTimeout( function () {
939					wcf_qv_content.html( '' );
940				}, 600 );
941			};
942		};
943
944		/*var	ast_qv_center_modal = function() {
945
946			ast_qv_wrapper.css({
947				'width'     : '',
948				'height'    : ''
949			});
950
951			ast_qv_wrapper_w 	= ast_qv_wrapper.width(),
952			ast_qv_wrapper_h 	= ast_qv_wrapper.height();
953
954			var window_w = $(window).width(),
955				window_h = $(window).height(),
956				width    = ( ( window_w - 60 ) > ast_qv_wrapper_w ) ? ast_qv_wrapper_w : ( window_w - 60 ),
957				height   = ( ( window_h - 120 ) > ast_qv_wrapper_h ) ? ast_qv_wrapper_h : ( window_h - 120 );
958
959			ast_qv_wrapper.css({
960				'left' : (( window_w/2 ) - ( width/2 )),
961				'top' : (( window_h/2 ) - ( height/2 )),
962				'width'     : width + 'px',
963				'height'    : height + 'px'
964			});
965		};
966
967		*/
968		const wcf_update_summary_height = function ( update_css ) {
969			const quick_view = wcf_qv_content,
970				img_height = quick_view
971					.find( '.product .wcf-qv-image-slider' )
972					.first()
973					.height(),
974				summary = quick_view.find( '.product .summary.entry-summary' ),
975				content = summary.css( 'content' );
976
977			if (
978				'undefined' !== typeof content &&
979				544 === content.replace( /[^0-9]/g, '' ) &&
980				0 !== img_height &&
981				null !== img_height
982			) {
983				summary.css( 'height', img_height );
984			} else {
985				summary.css( 'height', '' );
986			}
987
988			if ( true === update_css ) {
989				wcf_qv_modal.css( 'opacity', 1 );
990			}
991		};
992
993		const wcf_get_scrollbar_width = function () {
994			const div = $(
995				'<div style="width:50px;height:50px;overflow:hidden;position:absolute;top:-200px;left:-200px;"><div style="height:100px;"></div>'
996			);
997			// Append our div, do our calculation and then remove it
998			$( 'body' ).append( div );
999			const w1 = $( 'div', div ).innerWidth();
1000			div.css( 'overflow-y', 'scroll' );
1001			const w2 = $( 'div', div ).innerWidth();
1002			$( div ).remove();
1003
1004			return w1 - w2;
1005		};
1006
1007		wcf_qv_close_modal();
1008		//wcf_update_summary_height();
1009
1010		window.addEventListener( 'resize', function () {
1011			wcf_update_summary_height();
1012		} );
1013
1014		/* Add to cart ajax */
1015		/**
1016		 * wcf_add_to_cart_ajax class.
1017		 */
1018		const wcf_add_to_cart_ajax = function () {
1019			modal_wrap
1020				.off(
1021					'click',
1022					'#wcf-quick-view-content .single_add_to_cart_button'
1023				)
1024				.off( 'wcf_added_to_cart' )
1025				.on(
1026					'click',
1027					'#wcf-quick-view-content .single_add_to_cart_button',
1028					this.onAddToCart
1029				)
1030				.on( 'wcf_added_to_cart', this.updateButton );
1031		};
1032
1033		/**
1034		 * Handle the add to cart event.
1035		 *
1036		 * @param {Object} e event data.
1037		 */
1038		wcf_add_to_cart_ajax.prototype.onAddToCart = function ( e ) {
1039			e.preventDefault();
1040			const $form = $( this ).closest( 'form' );
1041
1042			// If the form inputs are invalid
1043			if ( ! $form[ 0 ].checkValidity() ) {
1044				$form[ 0 ].reportValidity();
1045				return false;
1046			}
1047
1048			const $thisbutton = $( this ),
1049				product_id =
1050					$form.find( 'input[name="product_id"]' ).val() || '',
1051				variation_id =
1052					$form.find( 'input[name="variation_id"]' ).val() || '',
1053				choose_var = $( '.wcf-variation-popup-open' ),
1054				qty_wrap = choose_var.closest( '.wcf-qty-row' ),
1055				qty_selection = qty_wrap.find( '.wcf-qty-selection' ),
1056				input_quantity = qty_selection.val() || 1,
1057				qty_options = qty_wrap.data( 'options' ),
1058				checkout_id = $( '._wcf_checkout_id' ).val(),
1059				item_wrap = qty_wrap.find( '.wcf-item-wrap' );
1060
1061			qty_options.input_quantity = input_quantity;
1062			qty_options.checkout_id = checkout_id;
1063
1064			if ( $thisbutton.is( '.single_add_to_cart_button' ) ) {
1065				$thisbutton.removeClass( 'added' );
1066				$thisbutton.addClass( 'loading' );
1067
1068				// Ajax action.
1069				if ( variation_id !== '' ) {
1070					jQuery.ajax( {
1071						url: cartflows.ajax_url,
1072						type: 'POST',
1073						data: {
1074							action: 'wcf_add_cart_single_product',
1075							form_data: $form.serialize(),
1076							product_id,
1077							variation_id,
1078							quantity: input_quantity,
1079							option: qty_options,
1080							security: cartflows.wcf_quick_view_add_cart_nonce,
1081						},
1082						dataType: 'json',
1083						success( response ) {
1084							console.log( response );
1085
1086							if (
1087								response.hasOwnProperty( 'cartflows_data' ) &&
1088								'yes' === response.cartflows_data.added_to_cart
1089							) {
1090								const result = response.cartflows_data;
1091
1092								/* Update Attributes to Name in summary */
1093								choose_var
1094									.closest( '.wcf-item' )
1095									.find( '.wcf-display-attributes' )
1096									.html( result.display_attr );
1097
1098								choose_var
1099									.closest( '.wcf-item' )
1100									.find( '.wcf-item-image' )
1101									.html( result.variation_image );
1102
1103								/* Update Variaiton id in attributes */
1104								choose_var.attr(
1105									'data-variation',
1106									result.variation_id
1107								);
1108								qty_options.variation_id = result.variation_id;
1109								qty_options.original_price =
1110									result.original_price;
1111								qty_options.discounted_price =
1112									result.discounted_price;
1113
1114								qty_options.subscription_price =
1115									result.subscription_price;
1116								qty_options.sign_up_fee = result.signup_fee;
1117								qty_wrap.attr(
1118									'data-options',
1119									JSON.stringify( qty_options )
1120								);
1121
1122								/* Item selector */
1123								const var_selection = qty_wrap.find(
1124									'.wcf-item-selector'
1125								);
1126
1127								if ( var_selection.length > 0 ) {
1128									const var_options = qty_wrap.data(
1129										'options'
1130									);
1131
1132									var_options.variation_id =
1133										result.variation_id;
1134
1135									qty_wrap.attr(
1136										'data-options',
1137										JSON.stringify( var_options )
1138									);
1139								}
1140
1141								/* Set display data */
1142								qty_wrap
1143									.find( '.wcf-display-quantity' )
1144									.html( result.display_quantity );
1145								qty_wrap
1146									.find( '.wcf-display-price' )
1147									.html( result.display_price );
1148								qty_wrap
1149									.find( '.wcf-display-discount-value' )
1150									.html( result.display_discount_value );
1151								qty_wrap
1152									.find( '.wcf-display-discount-percent' )
1153									.html( result.display_discount_percent );
1154								item_wrap
1155									.find( '.wcf_subscription_price' )
1156									.html( result.display_subscription_price );
1157								item_wrap
1158									.find( '.wcf_subscription_period' )
1159									.html(
1160										result.display_subscription_details
1161									);
1162								item_wrap
1163									.find( '.wcf_subscription_fee' )
1164									.html( result.display_signup_fee );
1165								item_wrap
1166									.find( '.wcf_subscription_free_trial' )
1167									.html( result.trial_period_string );
1168							}
1169
1170							// Trigger event so themes can refresh other areas.
1171							$( document.body ).trigger( 'wc_fragment_refresh' );
1172
1173							modal_wrap.trigger( 'wcf_added_to_cart', [
1174								$thisbutton,
1175							] );
1176						},
1177					} );
1178				} /*else {
1179					jQuery.ajax ({
1180						url: cartflows.ajax_url,
1181						type:'POST',
1182						data:'action=wcf_add_cart_single_product&product_id=' + product_id + '&quantity=' + quantity,
1183
1184						success:function(results) {
1185							// Trigger event so themes can refresh other areas.
1186							$( document.body ).trigger( 'wc_fragment_refresh' );
1187							//modal_wrap.trigger( 'wcf_added_to_cart', [ $thisbutton ] );
1188
1189							$( "body" ).trigger( "update_checkout" );
1190
1191							wcf_qv_close_btn.trigger( 'click' );
1192						}
1193					});
1194				}*/
1195			}
1196		};
1197
1198		/**
1199		 * Update cart page elements after add to cart events.
1200		 *
1201		 */
1202		wcf_add_to_cart_ajax.prototype.updateButton = function () {
1203			$( 'body' ).trigger( 'update_checkout' );
1204
1205			wcf_qv_close_btn.trigger( 'click' );
1206		};
1207
1208		/**
1209		 * Init wcf_add_to_cart_ajax.
1210		 */
1211		new wcf_add_to_cart_ajax();
1212	};
1213
1214	const wcf_two_step_validations = function () {
1215		const $billing_inputs = $(
1216			'.wcf-embed-checkout-form-two-step form.woocommerce-checkout .woocommerce-billing-fields, .wcf-embed-checkout-form-two-step form.woocommerce-checkout .woocommerce-account-fields'
1217		).find(
1218			'input[type="text"], input[type="tel"], input[type="email"], input[type="password"]'
1219		);
1220
1221		const $billing_chekboxes = $(
1222			'.wcf-embed-checkout-form-two-step form.woocommerce-checkout .woocommerce-billing-fields, .wcf-embed-checkout-form-two-step form.woocommerce-checkout .woocommerce-account-fields'
1223		).find( 'input[type="checkbox"]' );
1224
1225		const $billing_select = $(
1226			'.wcf-embed-checkout-form-two-step form.woocommerce-checkout .woocommerce-billing-fields'
1227		).find( '.select2' );
1228
1229		const $shipping_inputs = $(
1230			'.wcf-embed-checkout-form-two-step form.woocommerce-checkout .woocommerce-shipping-fields'
1231		).find(
1232			'input[type="text"], input[type="tel"], input[type="email"], input[type="password"]'
1233		);
1234
1235		const $shipping_chekboxes = $(
1236			'.wcf-embed-checkout-form-two-step form.woocommerce-checkout .woocommerce-shipping-fields .woocommerce-shipping-fields__field-wrapper'
1237		).find( 'input[type="checkbox"]' );
1238
1239		const $shipping_select = $(
1240			'.wcf-embed-checkout-form-two-step form.woocommerce-checkout .woocommerce-shipping-fields'
1241		).find( '.select2' );
1242
1243		const is_ship_to_diff = $(
1244			'.wcf-embed-checkout-form-two-step form.woocommerce-checkout'
1245		)
1246			.find(
1247				'h3#ship-to-different-address input[type="checkbox"]:checked'
1248			)
1249			.val();
1250
1251		//Add focus class on clicked on input types
1252		let access = true,
1253			field_focus = '';
1254
1255		Array.from( $billing_inputs ).forEach( function ( $this ) {
1256			const type = $this.type,
1257				name = $this.name,
1258				field_row = $this.closest( '.form-row' ),
1259				field_value = $.trim( $this.value );
1260
1261			let has_class = field_row.classList.contains( 'validate-required' );
1262			// whiteSpace  = /\s/g.test(field_value);
1263
1264			if ( name === 'account_password' || name === 'account_username' ) {
1265				const create_acc_checkbox = document.getElementById(
1266					'createaccount'
1267				);
1268
1269				if ( create_acc_checkbox ) {
1270					if ( $( create_acc_checkbox ).is( ':checked' ) ) {
1271						has_class = true;
1272					} else {
1273						has_class = false;
1274					}
1275				} else {
1276					has_class = true;
1277				}
1278			}
1279
1280			if ( has_class && '' === field_value ) {
1281				$this.classList.add( 'field-required' );
1282				access = false;
1283				if ( '' === field_focus ) {
1284					field_focus = $this;
1285				}
1286			} else {
1287				if (
1288					'email' === type &&
1289					false ===
1290						/^([a-zA-Z0-9_\+\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,14})$/.test(
1291							field_value
1292						)
1293				) {
1294					$this.classList.add( 'field-required' );
1295					access = false;
1296
1297					if ( '' === field_focus ) {
1298						field_focus = $this;
1299					}
1300				}
1301
1302				$this.classList.remove( 'field-required' );
1303			}
1304		} );
1305
1306		Array.from( $billing_chekboxes ).forEach( function ( $this ) {
1307			const field_row = $this.closest( '.form-row' ),
1308				has_class = field_row.classList.contains( 'validate-required' );
1309			let field_value = false;
1310
1311			if ( $( $this ).is( ':checked' ) ) {
1312				field_value = true;
1313			}
1314
1315			if ( has_class && false === field_value ) {
1316				$this.classList.add( 'field-required' );
1317				access = false;
1318				if ( '' === field_focus ) {
1319					field_focus = $this;
1320				}
1321			} else {
1322				$this.classList.remove( 'field-required' );
1323			}
1324		} );
1325
1326		Array.from( $billing_select ).forEach( function ( $this ) {
1327			const field_row = $this.closest( '.form-row' ),
1328				has_class = field_row.classList.contains( 'validate-required' ),
1329				field_value = $.trim(
1330					field_row.querySelector(
1331						'.select2-selection__rendered[title]'
1332					)
1333				);
1334			//Need to update naming convention.
1335			name = field_row.querySelector( 'select' ).name; //eslint-disable-line
1336
1337			if ( has_class && '' === field_value ) {
1338				$this.classList.add( 'field-required' );
1339				access = false;
1340				if ( '' === field_focus ) {
1341					field_focus = $this;
1342				}
1343			} else {
1344				$this.classList.remove( 'field-required' );
1345			}
1346		} );
1347
1348		if ( 1 === is_ship_to_diff ) {
1349			Array.from( $shipping_inputs ).forEach( function ( $this ) {
1350				const type = $this.type,
1351					field_row = $this.closest( '.form-row' ),
1352					has_class = field_row.classList.contains(
1353						'validate-required'
1354					),
1355					field_value = $.trim( $this.value );
1356
1357				if ( has_class && '' === field_value ) {
1358					$this.classList.add( 'field-required' );
1359					access = false;
1360
1361					if ( '' === field_focus ) {
1362						field_focus = $this;
1363					}
1364				} else {
1365					if (
1366						'email' === type &&
1367						false ===
1368							/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(
1369								field_value
1370							)
1371					) {
1372						$this.classList.add( 'field-required' );
1373						access = false;
1374
1375						if ( '' === field_focus ) {
1376							field_focus = $this;
1377						}
1378					}
1379
1380					$this.classList.remove( 'field-required' );
1381				}
1382			} );
1383
1384			Array.from( $shipping_select ).forEach( function ( $this ) {
1385				const field_row = $this.closest( '.form-row' ),
1386					has_class = field_row.classList.contains(
1387						'validate-required'
1388					),
1389					field_value = $.trim(
1390						field_row.querySelector(
1391							'.select2-selection__rendered[title]'
1392						)
1393					);
1394				//Need to update naming convention.
1395				name = field_row.querySelector( 'select' ).name; //eslint-disable-line
1396
1397				if ( has_class && '' === field_value ) {
1398					$this.classList.add( 'field-required' );
1399					access = false;
1400
1401					if ( '' === field_focus ) {
1402						field_focus = $this;
1403					}
1404				} else {
1405					$this.classList.remove( 'field-required' );
1406				}
1407			} );
1408
1409			Array.from( $shipping_chekboxes ).forEach( function ( $this ) {
1410				const field_row = $this.closest( '.form-row' ),
1411					has_class = field_row.classList.contains(
1412						'validate-required'
1413					);
1414				let field_value = false;
1415
1416				if ( $( $this ).is( ':checked' ) ) {
1417					field_value = true;
1418				}
1419
1420				if ( has_class && false === field_value ) {
1421					$this.classList.add( 'field-required' );
1422					access = false;
1423					if ( '' === field_focus ) {
1424						field_focus = $this;
1425					}
1426				} else {
1427					$this.classList.remove( 'field-required' );
1428				}
1429			} );
1430		}
1431
1432		// Focus the errored field
1433		if ( '' !== field_focus ) {
1434			field_focus.focus();
1435		}
1436
1437		return access;
1438	};
1439
1440	/*$(".wcf-qty [type='number']").on('keyup mouseup', function (event) {
1441		var input = jQuery(this).val();
1442		var input2 = input+jQuery(this).text();
1443		var step = jQuery(this).attr("step");
1444		var min = jQuery(this).attr("min");
1445
1446		if(!Number.isNaN(input2)){
1447			if(parseInt(input2) > min){
1448
1449				var remainder = input2%step;
1450				if(remainder !== 0){
1451					var new_value = parseInt(input2)  -  remainder;
1452					jQuery(this).val(new_value);
1453
1454				}
1455			}
1456		}
1457	}).trigger('mouseup');
1458
1459	jQuery(".wcf-qty [type='number']").on('focusout',function (evt) {
1460
1461		// var input = String.fromCharCode(evt.which);
1462
1463		var input = jQuery(this).val();
1464
1465		// var input_text = jQuery(this).text();
1466		// if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105)) {
1467
1468		var min = jQuery(this).attr("min");
1469
1470		if(!Number.isNaN(input)){
1471			if(parseInt(input) < min){
1472				jQuery(this).val(min);
1473			}
1474
1475		}
1476	});*/
1477
1478	const wcf_order_bump_buttons = function () {
1479		$( document ).on( 'click', '.wcf-bump-order-cb-button', function () {
1480			const $this = $( this ),
1481				parent_class = $this.closest( '.wcf-bump-order-action' ),
1482				input = parent_class.find( 'input[type="checkbox"]' );
1483
1484			if ( $this.hasClass( 'wcf-bump-add-to-cart' ) ) {
1485				input.attr( 'checked', true );
1486				$this.text( $this.data( 'adding' ) );
1487			} else {
1488				input.attr( 'checked', false );
1489
1490				$this.text( $this.data( 'removing' ) );
1491			}
1492
1493			parent_class.find( '.wcf-bump-order-cb' ).trigger( 'change' );
1494		} );
1495	};
1496
1497	const quantity_changer = function () {
1498		$( '.wcf-qty-selection-btn' ).click( function ( e ) {
1499			e.preventDefault();
1500
1501			const quantity_input = $( this )
1502					.parents( '.wcf-qty' )
1503					.find( '.wcf-qty-selection' ),
1504				min_value = quantity_input.attr( 'min' );
1505
1506			const val = parseInt( quantity_input.val(), 10 );
1507
1508			if ( $( e.target ).hasClass( 'wcf-qty-increment' ) ) {
1509				quantity_input.val( val + 1 );
1510			} else {
1511				quantity_input.val( val <= min_value ? min_value : val - 1 );
1512			}
1513			$( '.wcf-qty-selection' ).trigger( 'change' );
1514		} );
1515	};
1516
1517	$( function () {
1518		wcf_remove_product();
1519
1520		wcf_animate_browser_tab();
1521
1522		if ( 'yes' === cartflows.allow_autocomplete_zipcode ) {
1523			wcf_autocomplete_zip_data();
1524		}
1525
1526		wcf_product_quantity_var_options();
1527		wcf_do_not_remove_single_product();
1528		wcf_order_bump_ajax();
1529
1530		wcf_order_bump_buttons();
1531
1532		if ( $( '.wcf-embed-checkout-form-two-step' ).length > 0 ) {
1533			wcf_nav_tab_hide_show_events();
1534		}
1535
1536		//In multi checkout case we need to update the cart item key of the data-option for the product options.
1537		wcf_update_product_options_cart_item_key();
1538		quantity_changer();
1539	} );
1540} )( jQuery );

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.