Shopify themes, liquid, logos, and UX
As you can see when I select variant 30.5g, The size variant 6" of 30.5g should be auto select, isn't it? but it is not. (Dawn theme)
How can I fix this?
Solved! Go to the solution
This is an accepted solution.
Hey @thaxpy,
Go to your theme's "Edit Code" Option, then in the search bar type "theme.liquid".
Scroll to the end and above the tag "</body>" tag paste the following. Screenshot attached for reference.
<script>
document.addEventListener('DOMContentLoaded', function () {
let weights = document.querySelectorAll('input[name="Weight"]');
weights.forEach(function(value, index){
value.addEventListener('click', function() {
setTimeout(() =>{
let size = document.querySelectorAll('input[name="Size"]:not(.disabled)');
size[0].click();
found = true;
},100);
});
});
});
</script>
Screenshot for reference.
Hey @thaxpy,
Can you share the link to your store? Thanks!
This is an accepted solution.
Hey @thaxpy,
Go to your theme's "Edit Code" Option, then in the search bar type "theme.liquid".
Scroll to the end and above the tag "</body>" tag paste the following. Screenshot attached for reference.
<script>
document.addEventListener('DOMContentLoaded', function () {
let weights = document.querySelectorAll('input[name="Weight"]');
weights.forEach(function(value, index){
value.addEventListener('click', function() {
setTimeout(() =>{
let size = document.querySelectorAll('input[name="Size"]:not(.disabled)');
size[0].click();
found = true;
},100);
});
});
});
</script>
Screenshot for reference.
It really works, thank you!
Hello, thanks for the code but I want to tell you that it works in some versions of Dawn, but not in all, do you know how to solve it?
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025