Have your say in Community Polls: What was/is your greatest motivation to start your own business?

How can I trigger an event before adding a product to the cart?

How can I trigger an event before adding a product to the cart?

jamahlmd
Shopify Partner
2 0 0

HI guys,

I'm looking to build a feature that fires JUST before the user adds a product to the cart somewhat like CandyRack: https://apps.shopify.com/candyrack?search_id=9af07dd1-6824-4207-b138-28fabfc6139a&surface_detail=can...

I'm wondering how candy rack captures the add to cart event and then sends out the exact same event after closing out their window. I would like this exact behaviour.

The behaviour I'm talking about is that:
After you've installed the Candy rack app and created an offer.
When a user goes to the product page and clicks ADD TO CART. 

Nothing is added to the cart YET.
FIRST CandyRack opens and AFTER you either made a selection or clicked the close button THEN the add to cart event is fired.

Any ideas on how to do this?

All help is appreciated.



Reply 1 (1)

Pama
Shopify Partner
4 0 5

Hey could you find any solution or figure out a way how they do it?