magento2.3 – Nested attributes – Magento Stack Exchange

We are selling school uniforms and have about 40k of products. Our Magento 2 “categories” are basically schools we work with. We want to make a use of “layered navigation”, but facing a problem, which I describe below. The problem is quite advanced, so I will simplify it for demonstration purposes.

We want to assign some attributes to all our items and then use them for “layered navigation” filtering.

Let’s say we create a “type” attribute with multiple select values. The values would be:

“Type 1”
“Type 2”
“Type 3”
“Type 4”

Now, take an item and call it “Item A” for instance. It has a different significance for different schools, which forces us to assign different “type” values for "Item A" in different schools (categories). For example in:

“School Q” its “type” is “Type 1”.
“School X” its “type” is “Type 2” and “Type 3”.
“School Y” its “type” is “Type 1” and “Type 3”.
“School Z” its “type” is “Type 2” and “Type 4”.

Now, as you probably expect, if a customer filters by “type” and chooses “Type 1”, I want the “Item A” to be listed if the customer is in “School Q” category (page) or in “School Y” category (page).

It appears that this is not easily achievable with our current knowledge of Magento 2, so we had a little brainstorming session, but the results aren’t impressive. We figured out that since we work nearly 100 schools, we would end up with either ridiculous number of attributes per item or tens of thousands of duplicated products.

So, the question is whether there is any way of automatic filtering. Something like having this attribute called “school_type” with multiple select values of:

-   School Q: Type 1
-   School Q: Type 2
-   School Q: Type 3
-   School Q: Type 4
-   School X: Type 1
-   School X: Type 2
-   School X: Type 3
-   School X: Type 4
-   School Y: Type 1
-   School Y: Type 2
-   School Y: Type 3
-   School Y: Type 4
-   School Z: Type 1
-   School Z: Type 2
-   School Z: Type 3
-   School Z: Type 4

Then, in our instance, the “Item A” would have this attribute set to:

“School Q: Type 1”
“School X: Type 2”
“School X: Type 3”
“School Y: Type 1”
“School Y: Type 3”
“School Z: Type 2”
“School Z: Type 4”

Finally, there would be some sort of automatic filtering in place (perhaps on category level) that displayed “Item A” in the specified “types” only for the relevant schools (categories).

Please let me know if you are aware of anything that would serve the purpose in our case.