Following code solves the purpose:
add_filter('woocommerce_dropdown_variation_attribute_options_args','fun_select_default_option',10,1);
function fun_select_default_option( $args)
{
if(count($args['options']) > 0) //Check the count of available options in dropdown
$args['selected'] = $args['options'][0];
return $args;
}
Related Posts:
- Display single product attribute value on Shop page (Woocommerce)
- Get product details by url key in WordPress woocommerce
- Where is the “default attribute” values located in the phpMyAdmin in Woocommerce?
- Extend Woocommerce rest api routes fails
- woocommerce_before_calculate_totals in woocommerce 3.0
- How to get all attributes with their terms related to specific Woocommerce product category [closed]
- why featured product not updated in postmeta table in woocommerce?
- Programmatically adding product attributes to WP / Woo commerce
- WooCommerce Country Drop Down colours CSS [closed]
- Woocommerce custom search
- Get product variation attribute titles – WooCommerce
- How to change Attribute Type
- WooCommerce – buying as well as selling
- Is it possible to merge Woocommerce attributes? [closed]
- Best Practice – Customise a WooCommerce+WordPress Templates
- Change The Woocommerce Product Categories Dropdown Widget Placeholder Text
- WooCommerce: One term for Many Product Attributes
- Dropdown menu not displaying WordPress
- How to remove product attribute row woocommerce using code
- WooCommerce Simple Product Options List
- Woocommerce: Any way to list all products *without* a specific attribute?
- I want a simple dropdown for locations in woocommerce
- How to add product variations for large number of products in WooCommerce?
- WooCommerce: how to set stock per attribute on variable product
- Multiple quantities with options
- Importing Attributes in to Woocommerce
- Woocommerce: Some action hooks not firing inside class [closed]
- Is it possible Different templates of products for specific category in WooCommerce?
- WooCommerce – Adding Product Attributes to CSV Export
- WordPress and WooCommerce How to Assign Attribute Based Pricing
- Create templates from attributes for categories
- Get current WooCommerce endpoint not working
- Changing Woocommerce price display [closed]
- Which WooCommerce hook do I need to use to place the coupon field after the checkout sidebar
- WooCommerce Cart – Group Products By Category
- WooCommerce change price in cart [closed]
- Categories not shown in admin after adding woocommerce products via wp wc cli
- Enabling autosave when plugin disabled
- WooCommerce email text based on category && shipping zone && payment method [closed]
- WordPress Template not affecting the working, keeps defaulting to the index.php template
- woocommerce – get_image_size() deprecated [closed]
- Unable to display custom fields on WooCommerce product pages
- How to handle Woocommerce API credentials
- How can we display product price $104 on the cart while the credit card payment method is checked?
- Woocommerce Shipping label just hangs
- user password reset e-mail
- Extending the woocommerce product export functionality
- Woo Related Products How to override the plugin script?
- Line break on Product details [closed]
- WooCommerce add class name in the list [closed]
- How to display Woocommerce variations prices and descriptions
- Adding Transaction-Specific Conversion Tracking from Adwords into WooCommerce
- New field on checkout is shown but it’s not saved on the order details [closed]
- Woocommerce altered my homepage, and I can’t figure out how to revert it [closed]
- Woocommerce – Problem sorting and filtering products with different tax rates by price [closed]
- Why does my loop breaks the css below?
- How to add order status class to the body tag?
- Is it possible to remove editor from a custom product type?
- I am trying to make a field show and save from quickedit screen
- Show password while you are typing it on the “my account” login page
- /page/ is not working with a custom permalink structure (WooCommerce)
- WooCommerce Bookings Plugin Not Saving Order ID
- Customise Grouped Product display in Woocommerce with custom column
- Where is this text in a wordpress email coming from? Want to change/remove
- Add starts rating in woocommerce product comment from backend
- Need to check if user has completed a woo commerce payment
- Woocommerce show field in product if product-tag is “VET” else hide
- How to make a “subtitle” for each Woocommerce product
- Create Product with Woocommerce API, but Variations are not linked
- How to reduce checkout loading time of `?wc-ajax=checkout`
- unable to customize query to get filtered products by meta_key
- Woocommerce + Google Analytics (Conversion Rate Not Working)
- Woocommerce API security concerns
- How to add a wrapper element on image for products page
- Dynamic subdomains for woocommerce affiliate sales but NO multisite. Is that possible?
- Woocommerce posts and products links works only once and then get 404 error
- Limit image resolution on upload file for specific field
- Woocommerce pagination problem- page/2 = 404 solution
- Woocommerce , how to set billing_address via JS?
- Using admin email in billing address
- Enable Payment gateway if ACF checkbox in user profile is checked
- How do you reactive related products on WooCommerce when it has been disabled?
- Display product variations in shop page
- I want to use a product thumbnail completely different than the product image
- How can I locate where the actions are defined? [duplicate]
- Shortcodes in billing fields doesn’t work
- Update a user meta key based on WooCommerce product purchase
- show multiple product photos on WooCommerce single page
- How to get _POST variable on WooCommerce product page (form on homepage)
- Search box missing Woocommerce Product Bundle Extension
- DatePicker in Woocommerce (My Account) Registration [closed]
- problems with an object product wooCommerce [closed]
- CSS url rules not relative to css path in account endpoint areas. IE. subscriptions
- registration_errors not working
- Save And Display Mp3 Audio files on WooCommerce product page with Dokan
- Translate Woocommerce tab
- Product customizing quiz – quiz adding products to the cart
- Woocommerce -> gallery images per variation without a plugin? [closed]
- Why is my WordPress admin not working
- Create bookings after subscription renewal