8manos / wc-variations-radio-buttons

Let your customers choose product variations using radio buttons instead of dropdowns.
https://wordpress.org/plugins/wc-variations-radio-buttons/
GNU General Public License v2.0
63 stars 34 forks source link

Does not respect variation order (set via drag and drop in admin) #34

Closed JiveDig closed 6 years ago

JiveDig commented 6 years ago

As the title suggest. When i re-order my variations, it doesn't change them on the front end. I deleted all transients and tried as well.

JiveDig commented 6 years ago

Dug a little more.

When i dump $attributes in the variable.php template, it's in the order set in the Products > Attributes, and that's how they are displayed.

When i dump $available_variations in the variable.php template, it's in the custom order defined per-product via the Variations tab of the Woo metabox.

JiveDig commented 6 years ago

Seems like when your code uses:

// Get terms if this is a taxonomy - ordered. We need the names too.
$terms = wc_get_product_terms( $product->get_id(), $name, array( 'fields' => 'all' ) );

instead it should be using the $available_variations variable.

Mantish commented 6 years ago

Hi, In a variable product, you choose variations by selecting one or multiple attributes. You get a variation by selecting from the attributes that are displayed (as radio buttons in this plugin) in the product page. It's not possible to respect the order of variations, because those are not directly displayed in the product page.