This is solved by myself.
I fetched the query strings, stored them in variables and then after the iframe is loaded added the values to correspondent fields.
Cheers!
That is great news 🙂
You might like to share your solution for others.
Kind regards
Sure.
// Fetch Query Strings
jQuery(document).ready(function($){
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
let regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
//Store them in variables
let total = getParameterByName('total');
let email = getParameterByName('email');
let full_name = getParameterByName('full_name');
/*
Since I have different scenarios
and multiple forms (product shortcodes) on single page
I am showing different form based on total amount
and want the form to open automatically
*/
if (total == 165.00) {
setTimeout(function() {
$(".first-product-class").trigger('click');
$(".asp-popup-iframe").load (function(){
$('.asp-popup-iframe').contents().find('#email').attr('value', email);
$('.asp-popup-iframe').contents().find('#billing-name').attr('value', full_name);
});
},10);
}
else if...
});
Thank you very much 🙂
I am sure this will help those with the same requirements.
Enjoy the plugin.