In woocommerce, I've got a bunch of products, which all have a certain material assigned.
My current implementation of a material is a CPT (with about 20 fields (color, transparancy, reflection, shininess, etc.) stored as post-meta (not one big aray, but individual entries)). Since multiple products can share the same material, a product simply holds the id (again as post-meta) of the material-post assigned to it.
Now I want to create product-variations solely based on different materials. In order to create a variable product, one has to specify an attribute on which the variations are based.
So my question is: Should a material better be implemented as a taxonomy?
Thoughts one the subject:
- Wordpress doesn't implement a way to add meta values to taxonomies, but woocommerce does by using
update_woocommerce_term_meta. But by going this way, my material terms will contain a huge amount of data, compared to what woocomemrce uses this feature for (just adding a thumbnail image id to product categories). Is this a bad design choice or are there any other downsides?
- I read about custom fields for varations, which would enable me to stick with my current implementation of material as a CPT, but then, how would I even create variations whithout material being an attribute?
- I could make both a CPT and a taxonomy, where the latter can be used for varations and its terms simply hold the id of the corresponding material-post, but that requires additional track-keeping, because each time a term is added or removed, the corresponding material-post should be added or deleted as well. Doesn't sound like a good solution...
What are your thoughts, opinions and suggestions?