WooCommerce

 

Add Script to Product Page for Event

Embed the code below at the start of the registration flow - usually the event landing page.  The code consists of two parts...

  • The InGo Login Widget embed code snippet
  • Unique IDs for the event, to be stored in the browser for usage at checkout
<!-- Replace placeholders with Widget unique IDs as directed -->
<script type="text/javascript">
sessionStorage.setItem('InGoLW', '##-LOGIN-WIDGET-UNIQUE-ID-##'); // <-- Login Widget Unique ID
sessionStorage.setItem('InGoRW', '##-REGISTRATION-WIDGET-UNIQUE-ID-##'); // <-- Registration Widget Unique ID
sessionStorage.setItem('InGoCW', '##-CONFIRMATION-WIDGET-UNIQUE-ID-##'); // <-- Confirmation Widget Unique ID
sessionStorage.setItem('InGoSW', '##-SOCIAL-WIDGET-UNIQUE-ID-##'); // <-- Social Widget Unique ID
</script>

 

On the Checkout page...

Embed the code below on the WooCommerce checkout page below the WooCommerce checkout shortcode.

 <!-- embed below the woo commerce checkout shortcode -->

<!-- add jquery to the page -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<script type="text/javascript">
// Dynamically create InGo script tags using the unique widget IDs for the event
var lw = document.createElement('script');
lw.src = "https://cdn.ingo.me/widgets/" + sessionStorage.getItem('InGoLW') +".js";
lw.setAttribute("data-ingo-modal", "true);
lw.setAttribute("data-ingo-disable-close", "true);
lw.setAttribute("data-ingo-autostart", "true);
var rw = document.createElement('script');
rw.src = "https://cdn.ingo.me/widgets/" + sessionStorage.getItem('InGoRW') +".js";
var cw = document.createElement('script');
cw.src = "https://cdn.ingo.me/widgets/" + sessionStorage.getItem('InGoCW') +".js";
var sw = document.createElement('script');
sw.src = "https://cdn.ingo.me/widgets/" + sessionStorage.getItem('InGoSW') +".js";

$(document).ready(function() {

var redirectURL = window.location.href + "?disable-login-widget-popup=true";

// If the page is the billing details page...
if ((window.location.href.indexOf("/checkout") > -1) && (window.location.href.indexOf("/order-received") < 0)) {
// Embed RW on billing form
var existCondition = setInterval(function() {
if ($('form').length) {
clearInterval(existCondition);
$("body").append(lw);
$("body").append(rw);
}

}, 100);
// If the page is the urder received page...
} else if ((window.location.href.indexOf("/checkout") > -1) && (window.location.href.indexOf("/order-received")) > -1) {
// Embed CW & SW above the Woo Order Details element
var existCondition = setInterval(function() {
if ($('.woocommerce-order-details').length) {
clearInterval(existCondition);
$(".woocommerce-order-details")[0].before(cw);
$(".woocommerce-order-details")[0].before(sw);
}
}, 100);
}
});
</script>