solidusio-contrib / solidus_tracking

Data tracking extension for your Solidus store.
BSD 3-Clause "New" or "Revised" License
4 stars 10 forks source link

Check if an order has an email before sending an event #28

Open AdnanTheExcellent opened 3 years ago

AdnanTheExcellent commented 3 years ago

If I have a guest user who is attempting to check out, solidus_tracking + Klaviyo will error out on the event "started_checkout" since the order does not have an email attached to it yet, since adding an email happens during checkout.

Klaviyo::KlaviyoError: You must identify a user by email or ID

Can we add a check to see if the order has an email attached before triggering the event? Or, ideally, some method that can be overritten to check for eligibility. We only submit orders to Klaviyo when a user is signed in, so we'd like to suppress all tracking for guest users, which would include all of the order lifecycle events.