0

I want to get the variation price on my single product page, On change the variation drop-down using jQuery, Is there any way to doing this... ?

Thanks in advance.

aynber
  • 22,380
  • 8
  • 50
  • 63
Tehseen Ahmed
  • 147
  • 3
  • 15
  • link please if you already answer – Tehseen Ahmed Mar 09 '18 at 07:31
  • i just want to get the price on my on function when change the select box. – Tehseen Ahmed Mar 09 '18 at 07:32
  • This needs to be done with jQuery / javascript *(as it's a live even't on client side)*… See [this example](https://stackoverflow.com/a/44914240/3730754) or [this one](https://stackoverflow.com/questions/42349695/variable-product-selectors-getting-the-live-selected-values/42467820#42467820) that might be useful – LoicTheAztec Mar 09 '18 at 08:02

1 Answers1

2

woocoommerce has build in callback result product details (attributes, price, images, etc..)

you can see variation details on console

   jQuery(document).ready(function() {
    jQuery( '.variations_form' ).each( function() {

        // when variation is found, do something
        jQuery(this).on( 'found_variation', function( event, variation ) {
            console.log(variation);
            console.log(variation.display_price);//selectedprice
        });
    });
   });
Andy
  • 393
  • 1
  • 5
  • 17