Created
May 24, 2021 21:14
-
-
Save dizzyza/2e17526d9d76eb9f3cea2635af52fe1b to your computer and use it in GitHub Desktop.
Add Code From A Page To Hidden Fields In Gravity Form Embedded In Popup Maker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function custom_jc_woo_product_loop_Contact_for_bulk_pricing(){ | |
global $post,$product; | |
$formsku = get_post_meta(get_the_id(), '_sku' , true); | |
$permalink = get_the_permalink(); | |
//Request Quote Button, | |
echo "<a class='ab-item button pdfspec' href='' onclick=\"save_current_product('$formsku', '$permalink'); PUM.open(43068);return false;\">Request Quote</a>"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
jQuery(function($){ | |
// Populate SKU and embed_url hidden fields on popup opening. | |
$(document).on("pumBeforeOpen", "#pum-43068", function(){ | |
try { | |
$("#input_3_5").val(window.current_product_url); | |
$("#input_3_8").val(window.current_product_sku); | |
} catch(e) { | |
$("#input_3_5").val(""); | |
$("#input_3_8").val(""); | |
} | |
}); | |
}); | |
// save current product's SKU and URL to be available on popup opening. | |
function save_current_product(sku, url) | |
{ | |
window.current_product_sku = sku; | |
window.current_product_url = url; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment