Home Forums Basel support forum Hook on Add to Product and problem with ajax add to cart Reply To: Hook on Add to Product and problem with ajax add to cart

#6501

Human
Participant

Let me describe my problem in better words:

1- A user goes to product page detail and click on add to cart button.

2- Selected product will add to cart and along this my custom function runs:


function rg_add_rugpad_to_cart() 
{
// Action...
} 

add_filter('woocommerce_after_add_to_cart_button', 'rg_add_rugpad_to_cart', 12);

3- Another user goes to shop page and hover his mouse pointer on product thumbnail and Add to cart button will be shown.

4- He clicks on this hover button and selected product added to cart using AJAX, oh wait! this time my custom rg_add_rugpad_to_cart() function was not called! but It must be!

So how can I solve my problem?