0

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?

closed as off-topic by TheDeadMedic, Robert hue, Howdy_McGee, Brad Dalton, gmazzap Jul 9 '15 at 10:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • Looking at the function update_woocommerce_term_meta(), you would recognize it just uses the wordpress function update_metadata(), which essentially means that woocommerce is using meta values, just like you do in you CPT. With this in mind, I wouldn't think this procedure would slow down your site + your keeping compatibility by using existing functions. Also 20 extra rows per taxonomy should not be considered "huge amount of data" – Jeppe Jun 30 '15 at 11:30
  • Thanks, @Jeppe that was kind of the answer I was looking for. Since I'm new to Wordpress, I just wanted to make sure that I'm not doing anything stupid out of ignorance. If you change your comment into an answer I'll award you the bounty. – christoph Jul 1 '15 at 22:53
  • Glad to help, hope your project evolves well! – Jeppe Jul 2 '15 at 14:15
0
+50

Looking at the function update_woocommerce_term_meta(), you would recognize it just uses the wordpress function update_metadata(), which essentially means that woocommerce is using meta values, just like you do in you CPT. With this in mind, I wouldn't think this procedure would slow down your site + your keeping compatibility by using existing functions.

Also 20 extra rows per taxonomy should not be considered "huge amount of data"

Not the answer you're looking for? Browse other questions tagged or ask your own question.