TypeError: $.widget is not a function $.widget('mage.priceBox') $.widget('mage.dataPost')
How can I solve this?
I had the same problem using Porto Theme. In my case sometimes jQuery was recognized, sometimes not. Unfortunately, I didn't understand the cause, but I found a solution.
Irecommendedened to deploy the static files
Clear cache under
System -> Cache Management
Additional Cache Managementregion choose the Button
Flush Magento Cacheafterwards
Now clear Cache in Browser and reload.
For developing this solution is not satisfying, but at least for productive, use it should be a good working solution, without unpredictable behavior.
Hope it helps..
I had this issue as well but then I ran across this article: http://www.danjoseph.me/2016/09/16/magento-2-widget-not-function/
In the article he explains that jquery was being loaded a second time on the page and therefore overwriting the version loaded previously by magento. For me it was a marketing script that was also loading jquery for some reason. jQuery should only be loaded once in the head by this tag and all others should be removed.
Go to your theme folder and locate the following file in Magento_Theme folder
<script src="jquery.js" />
<remove src="jquery.js" />
Make sure you clean the cache and refresh the page.
I had the same issue and got it resolved using above method.