Created
October 9, 2018 09:18
-
-
Save marioloncarek/12b3a3cbff0c70b6db38c4762324c842 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
addBundleToCart.addEventListener('click', (event) => { | |
event.preventDefault(); | |
const productId = document.querySelectorAll('.js-ajax-bundle-form'); | |
const concatedProductIds = []; | |
let concatedProductIdsString = ''; | |
for (let i = 0; i < productId.length; i++) { | |
console.log(productId[i].getAttribute('data-product-id')); | |
if (i !== (productId.length - 1)) { | |
concatedProductIdsString += `${productId[i].getAttribute('data-product-id')}, `; | |
} else { | |
concatedProductIdsString += `${productId[i].getAttribute('data-product-id')}`; | |
} | |
} | |
concatedProductIds.push(concatedProductIdsString); | |
console.log(concatedProductIds); | |
addAllItems(concatedProductIds); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment