Switching variants no longer works unless all attributes in the product type have a value selected. Bug or expected behavior?
Closed this issue · 1 comments
Our studio has had three people spend the last two days trying to diagnose an issue we are having upgrading a Contao site from php8.0 to php8.1. We were finally able to recreate the issue on a separate site. This is what is
happening:
We have a site with 500 top level products, the majority of those have variants. Including the variants we have something around 3000 total products. There are lets say 20 different attributes and 5 different product types. Only some of the front end filterable variants have options selected for them. So, we would have 500 products using those 5 different product types, but some would have certain attribute options set while leaving others blank.
The problem is with PHP 8.1, the trying to select options on the frontend will not switch to the variants. We can only get the variants to switch if every available front end filterable attribute has an option selected. This wasn't an issue with php 8.0 but after switching to php 8.1 it no longer works.
We were able to recreate this issue on a separate PHP 8.1 site by copying a product type, making a test front-end filterable attribute setting and applying the product type to a product. So now the product has a blank filterable attribute in it. The variant switcher will not work unless all available frontend filterable attributes have something selected for them.
I've figured out that this is actually Isotope expected behavior. This was user error on our end. Apparently if you change a setting you can make the option to make something required or not show up. The person who initially set these up changed the option, turned them as being required off, then changed it back. So it was visually showing as not needed to be required, when in actuality they were.