Skip to content

Instantly share code, notes, and snippets.

@niveshsaharan
Created January 16, 2020 04:14
Show Gist options
  • Save niveshsaharan/67318c6bd745cecbfc47e9b37b897da0 to your computer and use it in GitHub Desktop.
Save niveshsaharan/67318c6bd745cecbfc47e9b37b897da0 to your computer and use it in GitHub Desktop.
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