What am I doing wrong when I inserted this code?

Solved
Christina4
Excursionist
22 1 3

I followed a tutorial to help show my stock on the product pages. The tutorial uses the same theme that I have, Debut, it's from 2021 and was very easy to follow, but the inventory still does not change when I select the different variants. I have redone this about 6 times. 

Here was the tutorial: https://www.youtube.com/watch?v=7aeYyBasHak

Here are screen shots of where I added the code they provided. Any idea what I did wrong?

 

Screen Shot 2021-02-24 at 7.32.35 AM.pngScreen Shot 2021-02-24 at 7.34.15 AM.png

 

0 Likes
tim
Shopify Expert
2926 142 994

This is an accepted solution.

If your theme is recent recent, then this code would not work, because the latest version of Debut does not include jQuery library, which is necessary for code like yours $('#product-inventory') to work.

You may confirm this by looking in your Developer tools console. If you see "$ is not defined" in red -- this is the reason.

Share a (preview) link to your shop for better diagnostics.

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
Christina4
Excursionist
22 1 3

Thanks for your reply. This would make sense, since I only started the account a couple of weeks ago. I managed to get in touch with the Shopify design team and used part of my complimentary design time to get them to help with this. They added a check box in my theme customization that does the function, so I don't have to mess with my code anymore. I'm going to mention your answer in the video comments though, in case any other debut users have the same problem!

0 Likes