Get a quick single-click solution to share your products on various social media platforms.Buy Now!
Public Ticket #1459

Price variation popup – auto display the price for the selected

Firoz

I have a popup with the following layout
Plan                   |      Subscription    |     Region  .

dropdown                dropdown                dropdown

There is a quantity and “Add to Cart” button and a label next to it for showing the amount. I am trying to load the default value when the popup opens  (inside this method $(“.show_ct_popup”).click(function(){}  ). But the amount not shown. But when I manually change the Region the price shows up. The following method I used to do the same. But I get an error “Uncaught TypeError: Cannot set properties of undefined (setting ‘selected’)”  because the amount section for price variation is not loading properly.  Is there anything else I have to do in script!?

if($(this).hasClass(‘std_mnth_bt’)){
setTimeout(function() {
$(‘#subscription’).val(’30 Day Trial’).trigger(“change”);
$(“#plan”).val(‘Standard’).trigger(“change”);
$.fn.changeRegion(2, id_number, middle);
}, 2500);
}

 

$.fn.changeRegion = function(regionOption, id_number, priceText) {
$(‘#region’).find(‘option’)[regionOption].selected=true;
$(‘#region’).trigger(‘change’);
$(‘form.variations_form’).find(‘input[name=variation_id]’ ).val(id_number ).trigger(‘change’); $(‘form.variations_form’).find(‘.woocommerce-variation-price span.woocommerce-Price-amount bdi’).contents().get(1).nodeValue = priceText;
};

Firoz

Firoz

wpx

wpx

Hi Firoz,

Thanks for reaching out to us. Will you please give us a link to check the issue for you?

Please record your issue using a tool like- https://loom.com. Then post the screen record link on this thread.

It will help us to understand your issue properly.

Thanks