I created some fields such as Color called field_color (taxonomy terms) in the product content type but whatever I do, when I create a product and set the field_color, the color name doesn't show up on the product page. I also tried to create fields programmatically with hook_install and hook_schema_alter but to no avail. Maybe I'm doing something wrong as I have never created any fields/schema before.
Here's how you create a term reference field to a CONTENT_TYPE:
- Create a taxonomy vocabulary called, say, "Color" at admin/structure/taxonomy/add.
- On admin/structure/taxonomy, click "add term" next to your new vocabulary.
- Add terms, such as, say, "blue", "red", etc.
- Go to /admin/structure/types/manage/CONTENT_TYPE/fields
- Add a new field called, say, "Color", and, set its "field type" to "term reference". Select an appropriate widget, such as "select list".
- Go to /admin/structure/types/manage/CONTENT_TYPE/display and set the field's display to, say, "link". You can try different display options, such as "plain text" too.
Hope that helps.
To create a node and save this field programmatically, follow this example, which has instructions for saving term reference fields.