I’ve been struggling to identify why I’m having issue executing scripts with shopify / debut theme. Other devs did work on this site before me so their maybe something custom they did.
Thank you. I felt it was an order of execution. Though I still don’t understand. Jquery is referenced above the header on theme.liquid - Why isn’t jquery ready (loaded) for every page on site in which I would call a library?
Reviewing the code you shared. I don’t understand how to use it. Where the scripts begin and end? Is it that it shouldn’t close after loadSomething(); to then run scripts on my other pages.
Clearly I’m outta my element here with JS. The other scripts I sourced from https://github.com/carolineschnapp to meet our needs for order info attributes + mandatory field select.
Very likely because it’s being loaded twice, though I’d need to debug it to be sure. Usually jQuery is imported in a vendors.js file on Shopify free themes (which I assume is what you’re using), so importing it again will make it be ignored or cause conflict.
I believe you are right that jquery might being loaded twice. Yes using the free Debut theme. I did review vendor.js - but not sure what I’m looking for specifically.
I don’t see any code referencing -
When I originally setup cart scripts I read to add the jquery source in theme.liquid - above the header. And neither of scripts functioned until added.
I tried the code you shared. Has same syntax errors that I encountered earlier when I guessed implied start / close tags. See screenshots. (Cart scripts also non functional)
If I have theme.liquid loading jquery above header the sample nanogallery2:
I was able to clone our old gallery and develop on it today using the other method. So I should be able to easily modify my gallery page to load using this method.
The standard Shopify theme structure is often times different than a default HTML website: whilst you may import external libraries using a script tag in your website, Shopify themes tend to load it all together within one single file, typically named vendors.js.
Therefore it makes sense that you wouldn’t find any in your theme.
You can use this Google Chrome extension to search the files in your theme and see where jQuery shows up.