Set Default Variation in WooCommerce

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.

Set variation default woocommerce single product page

There’s 2 solutions included. The

  1. 1st solution only works with a specific variation attribute key ( name ).
  2. 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 :

  1. Upload the folder named variation-default to your child theme folder.
  2. Copy and paste the PHP code ( without the opening PHP tag ) to the end of your child themes functions file.

Download Folder

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.