Woocommerce: Automatically select variable product radio button, if it's the only option available

257 Views Asked by At

I have a variable product where users can select different radio options from 3 attributes. The problem is, some attributes options are N/A (as the other attribute option cancels it out.)

EG: Attribute 1 - Size, Attribute 2 - Pattern, Attribute 3 - Colour,

Ie: if a user selects Large + Striped, Colour becomes N/A option only. or, Small + Red, pattern becomes N/A option only etc.

The issue is, when N/A appears as the only option for attribute 2 / 3, the user doesn't think they have to click anything. Is there some javascript I can add to auto-select the N/A option - if it becomes the only option available within the attribute?

Thank you!

0

There are 0 best solutions below