woocommerce offtopic - Javascript error when adding an item to the cart

admin2025-06-03  4

Closed. This question is off-topic. It is not currently accepting answers.

Closed 6 years ago.

  • Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
  • Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?
Improve this question

I have been trying to figure this issue out for hours and would really appreciate the help anyone can give. Do you have any idea how I can fix the Javascript error on this page that prevent adding items to the cart? /product/wildlife-photo-print-rhinoceros-charge-by-alex-jones/

Closed. This question is off-topic. It is not currently accepting answers.

Closed 6 years ago.

  • Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
  • Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?
Improve this question

I have been trying to figure this issue out for hours and would really appreciate the help anyone can give. Do you have any idea how I can fix the Javascript error on this page that prevent adding items to the cart? https://www.ourwildlife.studio/product/wildlife-photo-print-rhinoceros-charge-by-alex-jones/

Share Improve this question asked Feb 12, 2019 at 8:52 Liam MLiam M 33 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 3

The error I believe you are talking about when adding an item says:

Uncaught TypeError: $.parseHTML is not a function

Get ready to talk version numbers!

In this case $ is referring to the jQuery library.

jQuery.parseHTML was added in jQuery version 1.8. As it so happens, your site is currently using jQuery 1.7.2.

Since jQuery version numbers come up a lot with WordPress dev (imho), it's worth knowing how to check it. In your browser console, just type jQuery.fn.jquery and see what the answer is.

Caveat: sometimes people end up with multiple copies of jQuery on their site. You can try both jQuery.fn.jquery and $.fn.jquery and see if they're the same version. Even then you can't be sure you don't have multiple jQuery's.

So anyways, the issue is you have an old version of jQuery. That version of jQuery hasn't shipped with WordPress since WordPress 3.4. So either you have an old version of WordPress on the site and should upgrade it, or you (or a plugin you are using) are switching out the jQuery library in use on your site.

TL;DR update jQuery on your site, probably by updating WordPress.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748916494a314790.html

最新回复(0)