Skip to content

Magento 2 Add To Cart modal is not Opening instead refreshes the page

Console Errors: Uncaught Error: Mismatched anonymous define() module: function(){var e=!1,t=!1;function s(e){this.opts=r.extend({},{onClose:null,onOpen:null,beforeOpen:null,beforeClose:null,cssClass:[],policies:[]},e),this.init()}function i(){if(!t){t=!0;var e=document.createElement(“link”);e.type=”text/css”,e.rel=”stylesheet”,e.href=”https://cdn.websitepolicies.io/lib/embed/embed.min.css”,document.head.appendChild(e)}}function n(){this.wpembed=document.createElement(“div”),this.wpembed.classList.add(“wpembed-modal”),this.wpembed.style.display=”none”,”string”==typeof this.opts.cssClass&&(this.opts.cssClass=this.opts.cssClass.split(” “)),this.opts.cssClass.forEach(function(e){“string”==typeof e&&””!=e&&this.wpembed.classList.add(e)},this),this.closeButton=document.createElement(“button”),this.closeButton.type=”button”,this.closeButton.classList.add(“wpembed-close”),this.closeButton.innerHTML=”×”,this.wpembedContainer=document.createElement(“div”),this.wpembedContainer.classList.add(“wpembed-container”),this.wpembedContent=document.createElement(“div”),this.wpembedContent.classList.add(“wpembed-content”),this.wpembedContent.style.userSelect=”none”,this.wpembedContainer.appendChild(this.wpembedContent),this.wpembed.appendChild(this.closeButton),this.wpembed.appendChild(this.wpembedContainer)}function o(){this._events={policyLink:p.bind(this),closeButton:d.bind(this),clickOutside:c.bind(this),escButton:h.bind(this)};var e=this;this.policyLinks=document.querySelectorAll(‘a[href*=”/policies/view”‘);for(var t=0;t<this.policyLinks.length;t++)this.policyLinks[t].getAttribute(“data-wpembed”)&&”inline”==this.policyLinks[t].getAttribute(“data-wpembed”)||this.policyLinks[t].classList.contains(“wpembed-inline”)?this.policyLinks[t].getAttribute(“data-wpbusy”)||(this.policyLinks[t].dataset.wpbusy=!0,e.getPolicy(this.policyLinks[t],!0)):this.policyLinks[t].getAttribute(“data-wpbusy”)||(this.policyLinks[t].dataset.wpbusy=!0,this.policyLinks[t].addEventListener(“click”,function(t){t.preventDefault(),e.getPolicy(this)}));this.closeButton.addEventListener(“click”,this._events.closeButton),this.wpembed.addEventListener(“mousedown”,this._events.clickOutside),document.addEventListener(“keydown”,this._events.escButton)}function c(e){var t=this.wpembed.offsetWidth-this.wpembed.clientWidth,s=e.clientX>=this.wpembed.offsetWidth-15,i=this.wpembed.scrollHeight!==this.wpembed.offsetHeight;(“MacIntel”!==navigator.platform||0!==t||!s||!i)&&!function e(t,s){for(;(t=t.parentElement)&&!t.classList.contains(s););return t}(e.target,”wpembed-modal”)&&e.clientX<this.wpembed.clientWidth&&this.close()}function l(){for(var e=0;e<this.policyLinks.length;e++)this.policyLinks.removeEventListener(“click”,this._events.policyLink);this.closeButton.removeEventListener(“click”,this._events.closeButton),this.wpembed.removeEventListener(“mousedown”,this._events.clickOutside),document.removeEventListener(“keydown”,this._events.escButton)}function p(e){e.preventDefault(),this.open()}function d(e){this.isOpen()&&this.close()}function h(e){27===e.which&&this.isOpen()&&this.close()}s.prototype.init=function(){if(!this.wpembed)return n.call(this),o.call(this),i.call(this),document.body.appendChild(this.wpembed,document.body.firstChild),this},s.prototype.destroy=function(){null!==this.wpembed&&(this.isOpen()&&this.close(!0),l.call(this),this.wpembed.parentNode.removeChild(this.wpembed),this.wpembed=null)},s.prototype._busy=function(t){e=t},s.prototype._isBusy=function(){return e},s.prototype.isOpen=function(){return this.wpembed.classList.contains(“wpembed-visible”)},s.prototype.open=function(){return this._isBusy()?void 0:(this._busy(!0),”function”==typeof this.opts.beforeOpen&&this.opts.beforeOpen(),this.wpembed.style.removeProperty?this.wpembed.style.removeProperty(“display”):this.wpembed.style.removeAttribute(“display”),this.scrollPosition=window.pageYOffset,document.body.style.top=-this.scrollPosition+”px”,document.body.classList.add(“wpembed-enabled”),this.wpembed.classList.add(“wpembed-visible”),”function”==typeof this.opts.onOpen&&this.opts.onOpen.call(this),this._busy(!1),this)},s.prototype.close=function(){if(!this._isBusy()){if(this._busy(!0),”function”==typeof this.opts.beforeClose&&!this.opts.beforeClose.call(this)){this._busy(!1);return}document.body.classList.remove(“wpembed-enabled”),document.body.style.top=null,window.scrollTo({top:this.scrollPosition,behavior:”instant”}),this.wpembed.classList.remove(“wpembed-visible”),this.wpembed.style.display=”none”,”function”==typeof this.opts.onClose&&this.opts.onClose.call(this),this._busy(!1)}},s.prototype.setLoader=function(){this.wpembedContent.innerHTML=”},s.prototype.setContent=function(e,t,s,i){if(i){var n=document.getElementById(“custom_policy_css”);n&&n.parentNode.removeChild(n);var o=document.createElement(“style”);o.setAttribute(“id”,”custom_policy_css”),o.textContent=i,document.head.appendChild(o)}if(t){var… Read More »Magento 2 Add To Cart modal is not Opening instead refreshes the page

Magento2 Order email missing custom variable values for first time & when I send email from admin it shows values

Magento2 Order email missing custom variable values for first time & when I send email from admin it shows values Basically this custom variable values are the order attributes. I have used this email_order_set_template_vars_before event to set the order attribute… Read More »Magento2 Order email missing custom variable values for first time & when I send email from admin it shows values

custom widget to retrive price

I am new to this magento platform. I want to create a custom widget to retrive the price so that I can use it just by calling the widget at the front page. Any ideas/ Thanks