Hi, tell me how to get the variable cost of the product when I click on the button


#1

Open Link:
javascript:
var getCurrentPrice = function(){
var variants = JSON.parse($(‘form.variations_form’).attr(‘data-product_variations’)), currImage = $(‘form.variations_form’).attr(‘current-image’);
for(i in variants){
if(variants[i][‘image_id’] == parseInt(currImage)){
return variants[i][‘display_price’];
}
}}

Next:
Set variable value
price_product
value
getCurrentPrice();

Then:
Set text price-block to price_product

I attached the example below
test.rp (45.1 KB)