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

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.