I am trying to use the add_to_cart WooCommerce trigger to trigger a popup when certain products are added to the cart. So far I have managed to achieve the following results:
jQuery('body').on('added_to_cart',function() {
alert("testing!");
});
A warning window is displayed here when a product is added to the cart. However, I would like the warning to be displayed only for certain categories. But how can I check which category the product added to the basket belongs to?
Source to add to cart:
https://github.com/woothemes/woocommerce/blob/master/assets/js/frontend/add-to-cart.js
And this trigger in this question:
$( document.body ).trigger( 'added_to_cart', [ fragments, cart_hash, $thisbutton ] );