Only one line item script can be active at a time. If you already have a line item script running and you want to run this script in tandem, this will not work. You'll need to customize the scripts to work together.
MESSAGE - {string} A message that will be displayed on the free gift line item in the cart and checkout.
Script
# Editable ValuesMESSAGE='FREE GIFT FOR SIGNING UP!'######### DO NOT EDIT PAST THIS POINT########classInveterateFreeGiftWithSignupdefinitialize() @message =MESSAGEenddefrun(cart) @cart = cart startendprivatedefstart @customer = @cart.customer @line_items = @cart.line_itemsreturnunless valid_cart? discount_giftenddefvalid_cart? valid =false @line_items.each do|line_item|if line_item.variant.product.tags.include? 'inveterate-product' valid =truebreakendendreturn validenddefdiscount_gift @line_items.each do|line_item|# Skip if membership productnextif line_item.variant.product.tags.include? 'inveterate-product'# Skip if product is not the free giftnextunless line_item.variant.product.tags.include? 'inveterate-signup-gift'# Check quantity to create new line item if quantity is greater than 1 new_line_item =nilif line_item.quantity >1 new_line_item = line_item.split(take: 1) @cart.line_items << new_line_itemelse new_line_item = line_itemendputs new_line_item.quantity# Apply 100% discount new_line_item.change_line_price(Money.zero, message: @message )# Once discount has been applied once, break out so it doesn't get applied to another productbreakendendendCAMPAIGNS= [InveterateFreeGiftWithSignup.new()]CAMPAIGNS.each do|campaign| campaign.run(Input.cart)endOutput.cart =Input.cart