LagoVistaFilmLab Posted August 12, 2019 Share Posted August 12, 2019 (edited) My site: https://www.lagovistafilmlab.com/shop/developandscan I would love to set the default variant of "Select Scanning Size:" to default to "Enhanced JPG [included]. How do I go about doing that? Edited August 12, 2019 by LagoVistaFilmLab Initial Revision Link to comment
ivan-dabbles Posted June 16, 2020 Share Posted June 16, 2020 Same. Would love this feature. Link to comment
Yannis Posted September 29, 2020 Share Posted September 29, 2020 Same here! That would definitely speed up the checkout process Link to comment
Solution SpencerC Posted September 29, 2020 Solution Share Posted September 29, 2020 Hi everyone, Thanks for the valuable input! For any feedback that you would like to be logged, contacting our Customer Support team would be the best approach. As per section 6 of the forum guidelines we don't track feature requests in this forum. Thanks! SPENCER CHRISTIECUSTOMER OPERATIONS ADVISORHE/HIM Link to comment
DomBrady Posted June 9, 2023 Share Posted June 9, 2023 You don't need to pay for an app: use this code <script> function setValue() { var dropdown = document.querySelectorAll('[data-variant-option-name="Type"]')[0]; dropdown.value = 'Summer Flap'; Y.one(dropdown).simulate('change'); var dropdown2 = document.querySelectorAll('[data-variant-option-name="Colour"]')[0]; dropdown2.value = 'Orange $89'; Y.one(dropdown).simulate('change'); } window.onload = setValue; </script> Link to comment
AshAb Posted August 8, 2023 Share Posted August 8, 2023 (edited) <script> function setValue() { document.querySelectorAll('div.variant-option select').forEach(function(dropdown){ dropdown.selectedIndex = '1'; Y.one(dropdown).simulate('change'); }); } window.onload = setValue ; </script> The above code can put in `Page Header Code Injection` and it will select the first variant option and displays its price as well I modified @DomBrady answer to work with any product variant without having to specify variant details in code Edited August 8, 2023 by AshAb moije and DreamrW 1 1 Link to comment
DreamrW Posted January 28 Share Posted January 28 On 8/8/2023 at 6:28 AM, AshAb said: <script> function setValue() { document.querySelectorAll('div.variant-option select').forEach(function(dropdown){ dropdown.selectedIndex = '1'; Y.one(dropdown).simulate('change'); }); } window.onload = setValue ; </script> The above code can put in `Page Header Code Injection` and it will select the first variant option and displays its price as well I modified @DomBrady answer to work with any product variant without having to specify variant details in code Thanks for this!! 🙌🏼 Link to comment
jelsan Posted July 8 Share Posted July 8 On 8/8/2023 at 7:28 AM, AshAb said: <script> function setValue() { document.querySelectorAll('div.variant-option select').forEach(function(dropdown){ dropdown.selectedIndex = '1'; Y.one(dropdown).simulate('change'); }); } window.onload = setValue ; </script> The above code can put in `Page Header Code Injection` and it will select the first variant option and displays its price as well I modified @DomBrady answer to work with any product variant without having to specify variant details in code Hey Ash, this one doesn't seem to be working for me. Would you be able to take a look for me? product example: https://clementine-salamander-j4rd.squarespace.com/producten/p/eiken-tafel-oluf password: JELSAN2024 Link to comment
austinalltheway21 Posted August 2 Share Posted August 2 What if I'm not using the variant dropdown but rather squarespace's variant "button" site: creative-jewelers.squarespace.com pw: abc123 Link to comment
paul2009 Posted August 2 Share Posted August 2 13 minutes ago, austinalltheway21 said: What if I'm not using the variant dropdown but rather squarespace's variant "button" [how can I set the default variant] You should be able to select the first variant button using JavaScript. Try this: <!-- Select first variant when using variant buttons --------------------> <!-- Copyright Soundfocus Digital [https://sf.digital] ------------------> <!-- Use freely in your code injection. Do NOT re-publish. --------------> <script> document.addEventListener('DOMContentLoaded', function() { var sfpv = document.querySelector('.product-variants'); if (sfpv) { var sfvo = sfpv.querySelectorAll('.variant-option'); sfvo.forEach(function(option) { // Find the first element with the class variant-radiobtn-wrapper within the current variant-option var sfrbw = option.querySelector('.variant-radiobtn-wrapper .sqs-button-element--secondary'); if (sfrbw) { sfrbw.click(); } }); } }); </script> Did this help? Please give feedback by clicking an icon below ⬇️ austinalltheway21 1 Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional. Would you like your customers to be able to mark their favourite products in your Squarespace store? Link to comment
austinalltheway21 Posted August 2 Share Posted August 2 48 minutes ago, paul2009 said: You should be able to select the first variant button using JavaScript. Try this: <!-- Select first variant when using variant buttons --------------------> <!-- Copyright Soundfocus Digital [https://sf.digital] ------------------> <!-- Use freely in your code injection. Do NOT re-publish. --------------> <script> document.addEventListener('DOMContentLoaded', function() { var sfpv = document.querySelector('.product-variants'); if (sfpv) { var sfvo = sfpv.querySelectorAll('.variant-option'); sfvo.forEach(function(option) { // Find the first element with the class variant-radiobtn-wrapper within the current variant-option var sfrbw = option.querySelector('.variant-radiobtn-wrapper .sqs-button-element--secondary'); if (sfrbw) { sfrbw.click(); } }); } }); </script> Did this help? Please give feedback by clicking an icon below ⬇️ Thank you so much! That worked! paul2009 1 Link to comment
paul2009 Posted August 2 Share Posted August 2 48 minutes ago, austinalltheway21 said: Thank you so much! That worked! Great! It's looking good. austinalltheway21 1 Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional. Would you like your customers to be able to mark their favourite products in your Squarespace store? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment