Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WooCommerce: how to add listener to "found_variation" Event

I have a WooCommerce issue about variable products. I want to add listener to "found_variation" event of variations form to get information about the current product variation.

I have tried this one but does not work:

jQuery.fn.wc_variation_form.bind(
    'found_variation',
    function(event, variation) {
        console.log(variation); // logging to see the variation information
        $('#product-price').html(variation.price_html); // showing the variation price at custom html element
    }
);

Any ideas?

like image 273
zennin Avatar asked Oct 18 '25 14:10

zennin


1 Answers

I know this is an old post, but had the same issue. Eventually I got it working with the piece of code below:

$(document).on( 'found_variation', 'form.cart', function( event, variation ) {
/* Your code */           
});
like image 105
Chris Avatar answered Oct 21 '25 04:10

Chris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!