Advertisement
orenchuck

laline gtm reccom in minicart

Jan 29th, 2024
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. <script>
  2. (function () {
  3. if (document.readyState === 'loading') {
  4. document.addEventListener('DOMContentLoaded', clickHandler, true);
  5. } else {
  6. clickHandler();
  7. }
  8.  
  9. function clickHandler() {
  10. var SKU = ['M10809999999', 'M08602999999'];
  11. document.body.addEventListener('click', function () {
  12. setTimeout(function () {
  13. var miniCart = document.querySelector('.popup-container-cart');
  14. if (miniCart) {
  15. products = document.querySelectorAll('.sku');
  16. if (products) {
  17. products.forEach(function (item) {
  18. if (item.textContent.includes(SKU[0]) || item.textContent.includes(SKU[1])) {
  19. adoric && adoric.trigger('oilMinicart');
  20. }
  21. });
  22. }
  23. } else {
  24. adoric.lightboxes.forEach(function (item) {
  25. if (item.isShowing && item.options.campaignId === self.campaignId) {
  26. item.close(4);
  27. }
  28. });
  29. }
  30. }, 200);
  31. }, true);
  32. }
  33.  
  34. })();
  35. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement