jQuery(document).ready(function($) { // Function to populate the field function populateField() { var variationName = $('.woo-selected-variation-item-name').text().trim(); if (variationName.length > 0) { $('#form-field-field_70f4951').val(variationName).trigger('change'); } } // Try Elementor popup event first $(document).on('elementor/popup/show', function() { populateField(); }); // Backup method: detect when popup becomes visible const observer = new MutationObserver(function() { $('.elementor-popup-modal-1967').each(function() { if ($(this).is(':visible')) { populateField(); } }); }); observer.observe(document.body, { attributes: true, childList: true, subtree: true }); });