Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shopware Altersabfrage Modal
// check if cookie exist
if(!Cookies.get('of_age1')) {
// if not open the modal
$.modal.open('<div style="padding:20px">'+
'<p>Bist du schon über 18 Jahre alt?</p>'+
'<button class="btn">Ja ich bin über 18</button>'+
'</div>',{
title: 'Bist du schon 18?',
additionalClass: 'of_age',
width: 300,
height: 300,
closeOnOverlay: false,
showCloseButton: false,
});
}
// trigger the function if button is clicked
$('.of_age button').on('click', function() {
// Set the cookie
Cookies.set('of_age1', true);
// and close the modal
$.modal.close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.