Support » Plugin: WooCommerce Force Default Variant » WooCommerce 2.7 beta 1 compatibility?

  • Hello! This is exactly the plugin we were looking for but unfortunately, does not seem to work for us. We are using WooCommerce 2.7 beta 1 and it gives us an error saying something is amiss in the plugins variable.php file on line 11. Any plans to make compatible for 2.7 beta 1?

Viewing 1 replies (of 1 total)
  • I stumbled upon this note by coincidence (I’m not involved in the development of this plugin), but I think that pre-selecting the options should be relatively simple.

    Here’s an example of a function that selects the second option of each variation attribute.

     * Automatically selects the second option (i.e. the first "non blank" one)
     * in the variation attributes.
     * @author Aelia
     * @link
    add_action('wp_footer', function() {
      <script type="text/javascript">
        jQuery(document).ready(function($) {
          $('.variations_form .variations').find('select').each(function() {
            var $select = $(this);
            var $options = $select.find('option');
            // If there are two or more options, then we select the second one,
            // which is one immediately after the "Choose option" value
            if($options.length > 1) {

    The logic is simple: since the first option is always “select an option”, the script selects the second one. It runs on the frontend, on page load, so it shouldn’t really matter how the dropdowns are populated.

    • This reply was modified 4 years, 7 months ago by Diego.
Viewing 1 replies (of 1 total)
  • The topic ‘WooCommerce 2.7 beta 1 compatibility?’ is closed to new replies.