How to make variant dropdown required on product page?

Dear All,

I followed this link: https://help.shopify.com/en/manual/online-store/themes/os/customize/add-pick-an-option and made all the changes in default debut theme which i am using. Everything is working fine except one small issue and need your help to resolve it. When we load the product page for first time, it’s showing “Sold Out”(here i want Make a selection) Text below Pick a color. Refer the screenshot

After i select any color and then again if i select pick a color option, it’s showing " Make a selection. (This is right and i want to achieve the same when i open the product page for first time also. How can i do this?

Hello @Crazyblr ,

Use JS on page load and change the text of button also make it disabled.
Now in next step change function and remove disabled attribute from button which you added in first step.
And in last step in same change function get the value of select with if statement e.g. If select value = ‘pick a color’ { change button text again and make it disabled )

Thanks

Thanks @Guleria for the reply. I am not a techie, could you please explain it in little easier way please.

Then it will be best that you can hire a developer because we can’t write without checking id and classes used in your theme.