Set Default Product Variant

Highlighted
New Member
2 0 0

How can I set a default variant and not have it be the first in the list? A lot of the guides are based around hiding out of stock products but this is not related to my problem.

 

Ex.)

1

2

3 - Default

4

5

0 Likes
New Member
2 0 0

I used someones code from another form post with out any luck but after looking at the console log saw that their solution had a syntax error. Pasting this at the end of theme.js should work. 

 

$(document).ready(function() {
   $("select option[value='firstVariantName']").removeAttr("selected");
   $("select option[value='newDefaultVariantName']").attr('selected', 'selected').change();
});

The page still loads the first variant before switching it but this is hard to notice. With that being said if anyone has a fix for that problem be sure to post it here! 

0 Likes