WebTrend
New member
- Feb 2, 2021
- 15
- 2
- 3
function not_empty_cart_popup_function(){
global $woocommerce;
$items = $woocommerce->cart->get_cart();
if( count($items) > 0 || !empty($items) ) { ?>
// the JavaScript part comes here
<?php
}
return;
}
add_action( 'wp_footer', 'not_empty_cart_popup_function', 10, 5);
var mouseX = 0;
var mouseY = 0;
var popupCounter = 0;
document.addEventListener("mousemove", function(e) {
mouseX = e.clientX;
mouseY = e.clientY;
});
jQuery(document).mouseleave(function () {
if (mouseY < 50) {
if (popupCounter < 1) {
elementorFrontend.documentsManager.documents[11964].showModal();
}
popupCounter ++;
}
});
Ah, I see, it was in my original answer but disappeared when I had to edit the code sections. Anyway, you add this to the functions.php of your child theme or a snippets plug-in.Thank you for your answer. Where should I put that code ?
function not_empty_cart_popup_function(){
global $woocommerce;
$items = $woocommerce->cart->get_cart();
if( count($items) > 0 || !empty($items) ) { ?>
// Put the opening tag for javascript here
var mouseX = 0;
var mouseY = 0;
var popupCounter = 0;
document.addEventListener("mousemove", function(e) {
mouseX = e.clientX;
mouseY = e.clientY;
});
jQuery(document).mouseleave(function () {
if (mouseY < 50) {
if (popupCounter < 1) {
elementorFrontend.documentsManager.documents[11964].showModal();
}
popupCounter ++;
}
});
// Put the closing tag for javascript here
<?php
}
return;
}
add_action( 'wp_footer', 'not_empty_cart_popup_function', 10, 5);
Can you share the code as a file?
So, you're too lazy to take the code I shared above and turn it into what is in the screenshot?Can you share the code as a file?
Pull yourself together mate, not interested in the code, I have no requirements for the feature he requested.So, you're too lazy to take the code I shared above and turn it into what is in the screenshot?
I generally don't like people demanding everything readily presented on a plate without any effort whatsoever themselves. To me it's in the same league as people asking questions for which the answer is easily found via Google.
To answer your question:
NO
then don't share your code or don't help other ppl if you're too lazy to give it, i never saw people help other people on stackoverflow with just showing screenshot of code, even you just copy it from other website : code from hereSo, you're too lazy to take the code I shared above and turn it into what is in the screenshot?
I generally don't like people demanding everything readily presented on a plate without any effort whatsoever themselves. To me it's in the same league as people asking questions for which the answer is easily found via Google.
To answer your question:
NO
Oh wow. Just as I thought. Thanks for this output Bro.then don't share your code or don't help other ppl if you're too lazy to give it, i never saw people help other people on stackoverflow with just showing screenshot of code, even you just copy it from other website : code from here