This is the part of a vanilla JS code =
var prices = [100, 536, 2368];
But the above is hardcoded. I want them through an HTML select drop down:
<select class="license_type" name="license_type" id="license_type">
<option value="license" data-price="500">Single Site License</option>
<option value="license" data-price="700">5 Site License</option>
<option value="license" data-price="1400">Developers License</option>
</select>
Here values in the dataset are generated dynamically in woocommerce:
Data sets values will be dynamically generated based on the woocommerce product.
How can we make sure that the array var prices
is up to date always dynamically on each product page based on the variable prices?
Update →
There is a connection to this question answered here→ Woocommerce variation dropdown option tag add some dataset
(This is how we are introducing data-set in HTML of options tag)
Finally in browser it will be rendered like this:
Try this