I need a hook that fires after a product was added to cart. Something like a "woocommerce_add_to_cart" successful callback.
I imagine it would be something like "woocommerce_added_to_cart", but couldn't find anything like that. I know there is an ajax event "added_to_cart" but it will be a lot of code for me to do that via ajax.
Update - my use case: I am making slack notifications on my wc shop. All of my "Add to cart" buttons are ajax, and it takes approximatively 0.6 seconds from clicking "Add to cart" until it appears in the cart. If I add my slack notification with "woocommerce_add_to_cart" hook then it waits until it delivers the notification to slack and then updates the cart which is up to 2 seconds, which is too much. Best case scenario would be to have a php hook that fires after the product was successfully added to cart, which will not affect it.
Answering this old question for Google Searchers:
The action woocommerce_add_to_cart
is fired after an item is added to the cart. https://docs.woocommerce.com/wc-apidocs/source-class-WC_Cart.html#1118
and can be used like:
add_action( 'woocommerce_add_to_cart', function ()
{
// your code here
}
related action woocommerce_cart_item_removed
fires after an item is removed