How to insert term by name (by parent)

Let’s suppose I have terms like that :

SAMSUNG > PROTECTION > COVER
and
IPHONE > PROTECTION > COVER

and in codex, I have product that have these terms :
SAMSUNG, PROTECTION, COVER

how I can insert them to product? I can’t use

wp_set_object_terms( $post_id, 'COVER', 'product_cat' );

as I have also COVER in iphone, I tried many solutions but none work.

Thanks

Read more here: How to insert term by name (by parent)

Leave a Reply

Your email address will not be published. Required fields are marked *