-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56cf944
commit eff6f8a
Showing
8 changed files
with
307 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
document.addEventListener( 'wpcf7mailsent', function ( event ) { | ||
window[ window.gtmkit_settings.datalayer_name ].push( { | ||
document.addEventListener('wpcf7mailsent', function (event) { | ||
window[window.gtmkit_settings.datalayer_name].push({ | ||
event: 'gtmkit.CF7MailSent', | ||
formId: event.detail.contactFormId, | ||
response: event.detail.inputs, | ||
} ); | ||
} ); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,39 @@ | ||
// eslint-disable-next-line no-undef | ||
jQuery( document ).ready( function ( $ ) { | ||
$( document.body ).on( | ||
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' ), | ||
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"]' | ||
) | ||
.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 ) { | ||
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 ] ], | ||
window.gtmkit_data.edd.cart_items[item[0]], | ||
{ quantity } | ||
); | ||
} | ||
} else { | ||
Object.assign( | ||
window.gtmkit_data.edd.cart_items[ item[ 0 ] ], | ||
{ | ||
quantity, | ||
} | ||
); | ||
Object.assign(window.gtmkit_data.edd.cart_items[item[0]], { | ||
quantity, | ||
}); | ||
} | ||
} | ||
} ); | ||
}); | ||
} | ||
} ); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.