If your WooCommerce variations aren’t user friendly for the user because it’s always asking them to choose from a huge selection, or showing “Choose an option” or “Please select” text even if there’s only one variation, a simple fix will help make your WordPress e-commerce site more user friendly.

Simply add the following code to your theme’s (or preferably your Child theme) functions.php file, and the first available option will always be selected on your product pages.
add_filter('woocommerce_dropdown_variation_attribute_options_args','woo_select_default_option',10,1); function woo_select_default_option( $args) { if(count($args['options']) > 0) //Ensure product variation isn't empty $args['selected'] = $args['options'][0]; return $args; }
error in line 6
syntax error, unexpected ‘;’
Apologies, it parsed the greater than sign as & gt; instead of >. I’ve updated it.
It works, but linking to specific variation stopped working – it’ll prioritize auto-select first available option instead of url-based param variation.