title: Bulk change the order of attributes dropdowns on WooCommerce variable products
body: <p>I have 2 product attributes on my products: <strong>color</strong> and <strong>size</strong>. They are rendered in that order. I need to switch them, so that size always comes first.</p>
  
  <p>The WooCommerce file <code>single-product/add-to-cart/variable.php</code> seems responsible for the output, but I am not skilled enough to suggest a change to this code, that would make it order by <code>attribute_id</code>, <code>attribute_name</code>, or reverse default order. Right now they seem to order by a taxonomy term or slug rather than actual attribute data, changing ID or name of attributes in the <code>woocommerce_attribute_taxonomies</code> table does not help.</p>
  
  <p>Please help me crack this.</p>
  
  <p>I have searched for this without luck, the answer might be hidden among the many questions about attribute term order which is NOT what I am asking here. </p>
  
  <p>EDIT: I have thousands of products, so manual per-product reordering won't work.</p>
  
  <pre><code>$attribute_keys = array_keys( $attributes );
  
  do_action( 'woocommerce_before_add_to_cart_form' ); ?&gt;
  
  &lt;form class="variations_form cart" action="&lt;?php echo esc_url( apply_filters( 'woocommerce_add_to_cart_form_action', $product-&gt;get_permalink() ) ); ?&gt;" method="post" enctype='multipart/form-data' data-product_id="&lt;?php echo absint( $product-&gt;get_id() ); ?&gt;" data-product_variations="&lt;?php echo htmlspecialchars( wp_json_encode( $available_variations ) ); // WPCS: XSS ok. ?&gt;"&gt;
      &lt;?php do_action( 'woocommerce_before_variations_form' ); ?&gt;
  
      &lt;?php if ( empty( $available_variations ) &amp;&amp; false !== $available_variations ) : ?&gt;
          &lt;p class="stock out-of-stock"&gt;&lt;?php esc_html_e( 'This product is currently out of stock and unavailable.', 'woocommerce' ); ?&gt;&lt;/p&gt;
      &lt;?php else : ?&gt;
          &lt;table class="variations" cellspacing="0"&gt;
              &lt;tbody&gt;
                  &lt;?php foreach ( $attributes as $attribute_name =&gt; $options ) : ?&gt;
                      &lt;tr&gt;
                          &lt;td class="label"&gt;&lt;label for="&lt;?php echo esc_attr( sanitize_title( $attribute_name ) ); ?&gt;"&gt;&lt;?php echo wc_attribute_label( $attribute_name ); // WPCS: XSS ok. ?&gt;&lt;/label&gt;&lt;/td&gt;
                          &lt;td class="value"&gt;
                              &lt;?php
                                  wc_dropdown_variation_attribute_options( array(
                                      'options'   =&gt; $options,
                                      'attribute' =&gt; $attribute_name,
                                      'product'   =&gt; $product,
                                  ) );
                                  echo end( $attribute_keys ) === $attribute_name ? wp_kses_post( apply_filters( 'woocommerce_reset_variations_link', '&lt;a class="reset_variations" href="#"&gt;' . esc_html__( 'Clear', 'woocommerce' ) . '&lt;/a&gt;' ) ) : '';
                              ?&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;?php endforeach; ?&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
  </code></pre>