I really hope someone can help me with this problem asap.
Ok so I am building a costum script for users to publish a new product, I have everything working and inserting successfully (Event the photo) but just cant seem to find anywhere what code should be used to update the post category, as it is not a normal category because it has the taxonomy of "product_cat" (woocommerce product category).
Any ideas?
Non of the following work: ($term_id is the term_id that relates to the "product_cat" of a certain product)
wp_set_post_terms($post_id, array($term_id), "product_cat"); wp_set_post_terms($post_id, (int)$term_id, "product_cat"); update_post_meta($post_id,'product_cat',$term_id);
I have tried others but they just dont seem to do anything at all, some functions even create a new category with the id...