wp_remove_object_terms correct way to call child of parent taxonomy in woocommerce


In Woocommerce I am currently able to assigned and unassign a product taxonomy from a product by calling the following.

// to assign
wp_add_object_terms ( $product_id,'in-stock', 'product_cat' );

//to unassign
wp_remove_object_terms ( $product_id,'in-stock', 'product_cat' );

However how would one achieve this with a child of the parent taxonomy.

Do I need to call the parent and then the childs tag_ID ? Maybe something like below. Can someone clarify how I should correctly format ‘pa_stock&tag_ID=27’ please.

wp_remove_object_terms ( $product_id,'in-stock', 'pa_stock&tag_ID=27' );

Just to clarify pa_stock represents the parent taxonomy, tag_ID 27 represents the child taxonomy.

Lee Packman 2 years 2020-12-19T15:10:23-05:00 0 Answers 5 views 0

Leave an answer