• Not Answered

Reference Error: $ is not defined error on Storefront Site

Default storefront showing the following error on the storefront site

I have created the new default website again but same error in showing up again and again. can someone help me for solving this issue?

4 Replies

  • Hey Mukesh,

    Can you check in network tab if the following file is loaded?

    sxa.storefront.com/.../optimized-min.js

    There should be jQuery being loaded

    Or give a complete extraction of all errors in console in Case there are more.
  • In reply to Christian Hahn:

    Hey this script is loaded

  • Hi Mukesh,

    Seems like the theme for the site is off - make sure the right theme settings are set under /sitecore/content/Sitecore and /sitecore/content/Sitecore/Storefront. Also, try setting a theme on the Default page design and go to the home page.
  • If you are using any script file and getting "Uncaught ReferenceError:" which means 'x' is either a variable or a method which you are trying to use before declaring it using var keyword. This means that there is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it is available in your current script or scope otherwise , it will endup throwing this 'x' is not defined error . This usually indicates that your library is not loaded and JavaScript does not recognize the 'x'.

    To solve this error: Load your library at the beginning of all your scripts.

    There can be multiple other reasons for this issue:

    Path to CDN library you included is not correct
    The library file is corrupted
    Working offline
    Conflict with Other Libraries