Skip to content

Instantly share code, notes, and snippets.

@Vesely
Created May 11, 2020 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vesely/ff4a636f52197fb293b4c3e4c2cbdc4b to your computer and use it in GitHub Desktop.
Save Vesely/ff4a636f52197fb293b4c3e4c2cbdc4b to your computer and use it in GitHub Desktop.
Shoptet - přesměrování zákazníka do košíku po přidání položky do košíku
<script>
var redirectToCard = function() {
if (!document.body.classList.contains('ajax-pending')) {
setTimeout(function() {
window.location.href = '/kosik/';
}, 500);
} else {
setTimeout(redirectToCard, 500);
}
};
[].forEach.call(document.querySelectorAll('.add-to-cart-button'), function(button) {
button.addEventListener('click', redirectToCard);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment