Well,
I'm getting JS error "Cookies is not defined", but "js.cookie.min.js" is loaded before "woocommerce.min.js".
I check apache log to see if there's any error, but has none. I don't have caching plugins.
I don't know how to track this error to find the root cause, everything seems OK.
waitForImages is another JS that is loaded but I'm getting a error.
Am I missing something? Tips to find the bug?
EDIT*********
Further investigation
This is the code from js-cookie, for some reason I don't understand js-cookie is setting "registeredInModuleLoader" to true, but the variable "Cookies" is not defined yet.
;(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
define(factory);
registeredInModuleLoader = true;
}
if (typeof exports === 'object') {
module.exports = factory();
registeredInModuleLoader = true;
}
if (!registeredInModuleLoader) {
var OldCookies = window.Cookies;
var api = window.Cookies = factory();
api.noConflict = function () {
window.Cookies = OldCookies;
return api;
};
}
} /* ... */
EDIT 2
I think I found the issue, but don't know why yet.
Monday I put a singup form from MailChimp which needs this code. I think that the problem is with "embed.js", because in the condition "define.amd" (above) points to "embed.js". After remove this script the error is gone.
Any thoughts?
<script type="text/javascript" src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script>
<script type="text/javascript">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us14.list-manage.com","uuid":"xxxxxxxxxxxxxxxxxxxxxxxxx","lid":"xxxxxxxxxx"}) })</script>
SOLVED
I change the position of Mailchimp script to the last item before , no more issues.
Thanks.
I change the position of Mailchimp script to the last item before
</body>
, no more issues.Maybe mailchiump script tried to load something that aren't load yet..