Skip to content

2.1 Swatches form elements are incorrectly placed on the page #6164

@mikeymike

Description

@mikeymike

Preconditions

  1. Fresh install of 2.1
  2. A configurable attribute that uses swatches (i used textual swatches here)
  3. Configured product using the attribute above

Steps to reproduce

  1. Visit the product page
  2. Add to basket without selecting a swatch

Expected result

  1. Error message should show next to the relevant element in this case the swatches.

Actual result

  1. See the error message at the bottom of the form instead of below the swatches container

This can also be worse when you have multiple attributes using swatches, although I have not tested this I would expect it to provide multiple error messages at the bottom of the form again not relevant to the specific swatch with errors.


Potential Solution

I've looked through the code and it seems that the JS may have changed causing this problem. On this line it attempts to append to the end of the form which from my understanding in almost all cases is going to work... By commenting out this statement altogether and letting the code underneath handle the render it provides the desired output.

This code was introduced into 2.1 to resolve a bug on the category page but it seems it has caused a regression which wasn't picked up before release.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions