jQuery(document).ready(function($) {
// Listen for WooCommerce AJAX Add to Cart event
$(document.body).on('added_to_cart', function(event, fragments, cart_hash, $button) {
// Check if the off-canvas has already been shown this session
if (sessionStorage.getItem('cart_popup_shown')) {
// If it has run before, immediately stop Avada's Off-Canvas from popping up
// Note: Replace 'awb-off-canvas-xxxx' with your actual Off-Canvas HTML ID or class if needed
$('.awb-off-canvas-holder').stop(true, true).hide();
$('.fusion-off-canvas').removeClass('fusion-off-canvas-open');
} else {
// If it's the first time this session, set the marker so it won't open again
sessionStorage.setItem('cart_popup_shown', 'true');
}
});
});