The code in this download folder sets the 1st variation as the default variation in the variation option drop down menu on the single product page in WooCommerce.
There’s 2 solutions included. The
- 1st solution only works with a specific variation attribute key ( name ).
- 2nd solution works with any/all variations regardless of the variation attribute names.
Demo Video
Shows the first variation set as the default in the variation attribute option menu on the single product page.
Installation
There’s 2 steps :
- Upload the folder named variation-default to your child theme folder.
- Copy and paste the PHP code ( without the opening PHP tag ) to the end of your child themes functions file.
Was This Tutorial Helpful?