Custom code to automatically remove product from cart

Topic summary

A user is implementing a free gift promotion for orders over €80 using the Dawn Theme 7.0.1. They successfully coded the functionality to add the gift when the cart reaches the threshold, but encountered difficulty automatically removing it when the cart value drops below €80.

Another participant requested to see the custom code to potentially help troubleshoot the removal function.

Resolution: The original poster abandoned the custom code approach after being unable to create a cart value-based product removal function. They opted to use a third-party app instead to handle the conditional gift logic.

The discussion remains open with another user asking which app was chosen, but no response has been provided yet.

Summarized with AI on November 2. AI used: claude-sonnet-4-5-20250929.

Hello,

I am trying to hard code a free gift above 80€ in cart.

I am using: Dawn Theme 7.0.1.

I could make the code to add the Gift to cart when the cart amount is above 80€ but I couldn’t find a way to remove automatically the gift when the user removes items from cart and the cart is below 80€.

Someone knows how to do it please ?

Thank you

Hi @zied_drira

Could you share your custom code?

Hello,
I didn’t find a way to create a function that removes a product from cart based on cart value, so I used an app.

Which App did you use? This would help me a lot :slightly_smiling_face: