Created
January 16, 2020 04:14
-
-
Save niveshsaharan/67318c6bd745cecbfc47e9b37b897da0 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
window.addEventListener("Sellify::UCD::TieredFreeItemsRendered", function(){ | |
setTimeout(function(){ | |
$( '#sellify-ucd-tiered-free-items-container .ucd-unlocked-offer .upsell-submit' ).each( function(){ | |
var cartIds = sellify.ucd.original_cart.items.map( function( item ){ | |
return item.variant_id; | |
} ); | |
var id = $( this ).closest( 'form' ).find( '[name="id"]' ).val() | |
if( ! cartIds.includes( id ) ) | |
{ | |
$(this).click() | |
} | |
} )}, 2000) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment