There is currently no way to change the ordering of attributes in the variation title generation and the add to cart form.
Attributes are shown in the order in which they are created, as we are just using the list of field definitions.

There are two options here:
1) Load the default form mode and take the weights from there.
2) Add a drag&drop to the attribute table, and allow weight to be set there.

The downside to #1 is that users might not mentally connect the form mode weights with the ordering of the attributes in other contexts (such as the add to cart form).
It also means that to fully configure attributes the merchant must have access to the field UI, which is a requirement which we just removed with the attribute UI and the attribute checkboxes on the product type form.

The downside to #2 is that the weights are global, they would apply to attributes on all variation types.
Furthermore, there are now two weights, the one on the attributes UI and the other on the form display.
We can populate the form display weights from the attribute weights when the attribute fields are created, but any future edits to the attribute weights would not be reflected in the form display weights.

Comments

bojanz created an issue. See original summary.

agoradesign’s picture

I'd vote for #1 - I can't estimate, if my opinion would change, if I'd already had at least one store up and running...

For me, as site builder and developer, it feels wrong, when I change the order on the form display of the "add to cart" form and the changes are not reflected, when I render that form.

Additionally, the global weight problem will maybe don't disturb in 99% of all use cases, but if - and I think that's a realistic situation - you have project that falls into the 1% execptions, well then you'll have a big problem...

The Field UI argument on the other hand, is also not a bad one. I again think that in most cases different permissions for changing the order of attributes and fields are rare cases. These are site building tasks. As long as the merchant can add/edit/delete attribute values, I don't see a big problem here

bojanz’s picture

For me, as site builder and developer, it feels wrong, when I change the order on the form display of the "add to cart" form and the changes are not reflected, when I render that form.

We are talking about two different form displays though, "add to cart form" is a line item form display, and this is the variation form display. They are not connected.

agoradesign’s picture

Ok, maybe I've mixed up the terms :D But in general: if I have a form display I can order by weight, and this form is rendered somewhere in different order, it seems wrong to me

  • bojanz committed 2c17d31 on 8.x-2.x
    Issue #2699019: Can't change the ordering of attributes
    
bojanz’s picture

Status: Active » Fixed

Went with option #1. The weight of the attributes on the variation form display is now used everywhere (title generation, add to cart widget).

Londova’s picture

There is still a bug.
I added attributes Colour and Size, after that changed their order. Created a product with following variations:
size: 100, colour: Black, Blue
size: 200, colour: Red, White
size: 1000, colour: Yellow, Green

On Add to Cart page, the first displayed variation is: size-100, colour: Black or Blue.
When changing the size to 200 the colour options doesn't change to Red, Green (still displayed options Black, Blue). The same happen when select the size 1000.

bojanz’s picture

@British-Link
Sounds like #ajax doesn't actually work for you.
Please open a new bug report. Include any additional data that could help us track this down (anything shown in the browser console? In drupal's reports?)
I'll try to look at it next week.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.