The Tapcart Gift with Purchase feature allows users to add a free gift to their checkout upon reaching a certain cart threshold.



Your store needs to be on Shopify Plus to use Shopify Scripts in order to access this feature.

1. Start by creating a collection and populate it with products that are to be included in the Gift Engine feature.
2. Send the Collection ID to your Tapcart account manager.
3. Install the Metafields2 App in the Shopify Dashboard
4. Create meta field namespace and key for threshold:

-- 4a. c_f should be the namespace

-- 4b. [p]Gift Threshold Amount should be the key

5. Add the Threshold amount meta field to each product within the collection in cents (i.e. 9000 for a $90 cart threshold to be eligible for a gift)
6. Using the Shopify script editor, add a script to identify “_smgift“:”1” on each product and discount the price if that attribute is applied to a line item.

Here is an example script that you can use:

Input.cart.line_items.each do |line_item|  #line_item.change_properties({"_smgift" => "0"}, { message: "Woot" })    if["_smgift"] != nil      @disc =["_smgift"].to_f      if(@disc == 1)        # Let's assume that 1 = 100% off        @disc = 0      elsif(@disc > 1)        @disc = @disc/100      end      line_item.change_line_price(line_item.line_price * @disc, message: "FREE GIFT")    endendOutput.cart = Input.cartInput.cart.line_items.each do |line_item|  #line_item.change_properties({"_bundle_discount" => "0"}, { message: "Woot" })    if["_bundle_discount"] != nil      @disc =["_bundle_discount"].to_f      if(@disc == 1)        # Let's assume that 1 = 100% off        @disc = 0      elsif(@disc < 1)        @disc = (1-@disc)      end      line_item.change_line_price(line_item.line_price * @disc, message: "Bundle Item")    endendOutput.cart = Input.cart

Finally, please provide us an image like the examples below, which will be within your cart for users to interact with.

Did this answer your question?