Note: A new version of Loft has been published to the theme store (version 1.4.10.2) which resolves this issue. You can resolve this issue simply by updating your theme to the latest version from the theme store here.
Bug:
When product page is set to use drop downs for the variant selector and had multiple variant options available (color, size, materials, etc..), the variant would show "unavailable" as soon as you changed the selected variant, regardless of that variants actual availability.
Reason:
There's a variable inside the code that tracks a products variants which used to be reset in our old structure to help account for re-init events. We've since revamped our swatch code and tuned how our variant scripts operate, but unfortunately that product variant variable didn't get taken out, so when you change the variant selected, it forgets the variant information and shows "unavailable" instead.
Fix:
You just need to delete the variable causing the reset. Here's how you can do this on your copy of Loft:
- Under "Online Store", navigate to the "Themes" page.
- On your Live theme (or the backup theme having the issue), click "Actions" and then "Edit Code" as seen in the screenshot attached:
- On this page, find the "Assets" folder in the left hand theme file directory. Inside this folder, open up "theme.js.liquid".
- Once the file opens up, click inside the code window and open the search menu by hitting Ctrl + F. You should see the native search popup in the top right. Copy and paste this into that search popup and hit enter:
productVariants = [];
- Note: the screenshot attached in step 4 shows the variable we are looking for on line 1643. That may not be 100% the same for your theme if any modifications have occurred and depending on which version you are using. So to ensure you have the right variable, look for the one below the line:
var $container = $(container);
See step 4 screenshot as an example of what you are looking for
- Delete that line of code. Now hit save in the top right. The variant dropdowns should be working now.
- Confirm that changing the variant drop downs show the right information instead of showing "unavailable"
If you have any questions or need help making these changes to your theme, submit a support ticket to us and we'll help get you situated!
Thank you for reading and being apart of the Loft community!