Hello fellow community members! I am looking to implement a free gift logic on my store, but not sure how to implement that. Can someone please help me with that.
Thanks!
CraftTech
Hello fellow community members! I am looking to implement a free gift logic on my store, but not sure how to implement that. Can someone please help me with that.
Thanks!
CraftTech
Yea sure provide more info about thus integration
Hey @CraftTech ,
The gifting feature is available through various third-party apps on the Shopify App Store, you can use these apps to gift products. Here are a few apps that can help you implement the functionality you’re looking for:
Also, you can check out other apps on the Shopify app store using the link: Gifting Apps
If my response helped you, please consider giving it a like (
) and marking it as an accepted solution if it resolved your issue. Your feedback helps other community members with similar questions.
Thank you!
Regards,
Abhishek from Swym
I am looking for a feature where if you add a main product to the cart, then the gift product automatically gets added as well.
thank u for sending these apps lists, but i dont want to go that route. I want this to be custom built. no third-party apps.
I have a dev friend, but he actually does not know the logic behind this.
Hey @CraftTech ,
since you already have a dev friend, who can work for you then please see the general steps below to implement the gift product logic on your store:
a. Update the code in the product section file to check if a product includes an associated gift item. If it does, the gift product should automatically be added to the cart along with the main product. You can use the Post API for Ajax Cart to build this custom functionality.
b. Additionally, ensure that custom properties are added to both the main product and the associated gift product to link them together. This will help in building the logic for removing the gift product when the main product is removed from the cart. Use an underscore (_) as a prefix for the properties key to keep these properties hidden on the cart page.
a. Whenever a product is removed from the cart, check whether it contains a gift product or not? If it does, fetch the cart (line items) contents in the cart using the GET API for the Ajax cart.
b. Once you have fetched the updated line item contents, then search for the free item using the unique key that was added to the product as mentioned in step 3(b).
c. Update the quantity of that free item in the cart to 0. Again for this, you have to use the POST API to change cart quantity.
Once you’ve implemented all the steps above—bingo! Your work is done. However, please keep in mind that these are the general steps I would follow to implement the gift product logic in a store. The actual complexity can only be assessed during implementation, as it may vary depending on your theme’s code structure and existing setup.
I hope this helps!
Thanks!
Regards,
Abhishek from Swym
Hey @swym ,
Thanks for sharing the detailed steps. I will defintely try these steps out and let you know if we are able to implement this or not.
We were able to implement the add the gift product to cart with the main product, but are not able to actually remove it once the main product is removed from the cart. Can u help in this pls
Hey,
That’s great that you’ve implemented the gift product-to-cart logic along with the main product! Now, to remove the gift product along with the main product, as I mentioned earlier, you’ll need to add a custom property to both the gift and the main product when adding them to the cart.
Make sure to use a property name with an underscore prefix (e.g., _giftProduct) to keep it hidden from customers on the front end. You can use any unique identifier to link the two products, such as a timestamp or a combination of the main product and gift product IDs.
Once this is done, now you need to update the product delete logic to check whether the product removed is a normal product or a main product. If the product being removed is a main product, use the unique key to identify the associated gift product and remove it from the cart as well.
I hope this helps.
Regards,
Abhishek from Swym
Hi,
To apply a free gift on your store, you can set up offers such as BOGO (Buy One Get One), Buy X Get Y, Spend more, get more, or Spend X amount to get a gift.
There are several third-party apps that can help you run these offers smoothly without complex setup.
You can check out one option here: BOGOS: Free Gift Bundle Upsell - One-stop app for free gift with purchase, buy x get... | Shopify App Store