HEX
Server: Apache/2.4.41
System: Linux mainweb 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC 2024 x86_64
User: nationalmedicaregrp (1119)
PHP: 8.3.7
Disabled: exec,passthru,shell_exec,system,popen,proc_open,pcntl_exec
Upload Files
File: /home/commandofl/public_html/wp-content/plugins/gtm-kit/src/js/edd-checkout.js
// eslint-disable-next-line no-undef
jQuery(document).ready(function ($) {
	$(document.body).on(
		'change',
		'.edd-item-quantity',
		gtmkitEddUpdateItemQuantity
	);

	function gtmkitEddUpdateItemQuantity() {
		const $this = $(this),
			quantity = parseInt($this.val()),
			key = $this.data('key'),
			downloadId = $this.closest('.edd_cart_item').data('download-id'),
			options = JSON.parse(
				$this
					.parent()
					.find('input[name="edd-cart-download-' + key + '-options"]')
					.val()
			);

		const cartItems = Object.entries(window.gtmkit_data.edd.cart_items);
		cartItems.forEach((item) => {
			if (item[1].download.download_id === downloadId) {
				if (typeof item[1].download.price_id !== 'undefined') {
					if (item[1].download.price_id === options.price_id) {
						Object.assign(
							window.gtmkit_data.edd.cart_items[item[0]],
							{ quantity }
						);
					}
				} else {
					Object.assign(window.gtmkit_data.edd.cart_items[item[0]], {
						quantity,
					});
				}
			}
		});
	}
});