Skip to content

Instantly share code, notes, and snippets.

@Robin-bob
Created October 8, 2019 11:24
Show Gist options
  • Save Robin-bob/8bce08e820b238b28ebaaa496200a0cb to your computer and use it in GitHub Desktop.
Save Robin-bob/8bce08e820b238b28ebaaa496200a0cb to your computer and use it in GitHub Desktop.
add Program To Favorites After Purchase
<script>
function addProgramToFavoritesAfterPurchase() {
var button = document.querySelector('.favorite.s-button');
var notClicked = true;
if (button && notClicked) {
if (document.referrer.includes('orders/success')) {
document.querySelector('.favorite.s-button').click();
notClicked = false;
}
} else {
setTimeout(function(){
addProgramToFavoritesAfterPurchase();
},500)
}
}
addProgramToFavoritesAfterPurchase();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment