I use this function to set a new category

wp_set_object_terms($product_id, $data[1], ‘product_cat’);

but i’d like to add a parent at this category… how could I do?

Read more here: set a parent category in a product woocommerce


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: