I'm having trouble creating attributes for products. For example I have products that have different color. So the main attribute is Color and the Variables would be Red, Orange and Purple.
I have tried the following but I am unable to set it.
wp_set_object_terms( 165, 'Color', 'pa_colour' ); wp_set_object_terms( 165, Array("Red", "Orange", "Purple"), 'pa_colour' );
How do I create the attributes first and link them to the product?