We are trying to set up a gift with purchase where is a customer who has bought more than x amount and applies the code at checkout the gift should get added as 0$.
To do this we implemented the following approach:
- Created a Buy x get y code - GWP1 (Automatic discount)
- created another product discount with the same discount code as GWP1 (discount code)
- We implemented a checkout extension where we are listening “usediscountapply” to check for GWP1
- We are adding the free gift item when we hear the event through cart api
We only want some users to avail this as we are sharing the discount code secretly with some of users so showing a ui will not be feasible.
This method is working fine on our dev store but on production some users are getting the gift and some are not.