Dealing with JQuery conflicts

Jquery conflicts will stop the application from working as expected.

You may have a jquery conflict if you experience any of the following:

  • Adding items to cart results in a spinner that does not disappear
  • Items fail to add to cart
  • Calculator Rules do not work as expected
  • You see $ is undefined in browser debug / console logs

This can happen if other installed applications are conflicting with Option Price Calculator requirements or your theme is including a different version of jquery.

Troubleshooting

Determine what version of JQuery is loading on your store.

  1. Open your store in a web browser.
  2. Right click anywhere eon the page and go to Inspect.
  3. Go to Console tab.
  4. Run the following command:

    $().jquery; 

    Console should return 3.5.1

If console returns jquery undefined or $ undefined, jquery is not installed on the page.

You may want to test this on your product page and your cart page separately. Sometimes themes may not load all expected resources on each page.


JQuery missing from store

  1. Go to Online Store => Themes
  2. Click Actions and go to Edit code
  1. Search and open Theme.liquid
  1. Find the closing </head> tag.
  2. Paste the following code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>


Incorrect version of JQuery

An incorrect version of jquery often means you need to follow instructions to install jquery or add a newer version of jquery to your store. It may mean you need to track down and remove other references to jquery in your store.

A different version of jquery will likely stop Option Price Calculator from operating as expect.