@Shadylady Hey Charles, welcome to the Community.
The reason why I think there isn’t a cut and dry “Copy/Paste” code with WooCommerce is simply because WooCommerce (Wordpress) is so customizable (with multiple versions) that I think there isn’t exactly one way to do it based on how your particular instance of WooCommerce is setup. It’s kind of the trade-off between a “highly opinionated” framework (like Shopify or BigCommerce) versus a totally open ended platform like Wordpress.
If you want the general idea, you can send “any” Events into Klaviyo from the client side via the Klaviyo Javascript API. “Added to Cart” uses the same methodology as any event you would send to Klaviyo - you set an “Track Event” and pass in any associated data of that Event to Klaviyo via Javascript - in this case, whenever someone “Adds to Cart” which is typically a “Button” on your site that’s triggered onClick().
However, some sites have other unique implementations to “Add to Cart” (Links? Checkbox to add multiple things to cart?, Ajax Triggered to Load a SideCart? Submit to a page to handle Add to Cart with other business rules? A 3rd Party plugin that triggers and Add to Cart, etc) so it’ll vary based on how you “Add to Cart” is implemented on your Wordpress Theme.
To generalize, for “Added to Cart” event, normally you would pass an event labelled “Added to Cart” along with all the details (key/value) pairs of all relevant information of the item so you can use them in your Email Template when the Event occurs:
- Item ID
- Image URL
- Product Name
- Product URL (slug)
- SKU
- Price
- Categories
- Tags
- Discounted Price?
- Variant Details (Color? Size? etc)
- Product Description?
- (Bonus) List of Other Cart Items?
You can have your Developer reference these articles to get started:
The Shopify “Added to Cart” depends on the same script from the “Viewed Product” Event - so you can borrow some of the ideas and implementation detail there as well:
Hope this helps, if not, perhaps a WooCommerce/Wordpress developer can share a common code or snippet that can get you started here in the community!
Hi, thank you so much for the warm welcome and response!
Even for a non-techie like myself, your response makes complete sense so thank you for taking the time to explain it and break it down for me. I really appreciate it!
I will pass this on to my developer in hopes he’ll know how to act on it but in case he has any issues, are you able to recommend any agencies or freelancers that could help me with this?
Thank you again! :)
Hey @Saha Self-care We developed the Klaviyo Toolkit plugin that passes the Add to Cart event from WooCommerce to Klaviyo.