• Resolved xclamation

    (@xclamation)


    Hi,

    I’m writing a plugin that, upon a product variation being sold and going out of stock, automatically deletes the specific variation and should also delete the specific attribute from the product that is used by the variation.

    I’ve tried using the function wp_remove_object_terms( $product_id, $terms, $taxonomy ); but this doesn’t appear to be removing the attribute from the product.

    In my test site, the value for $terms is a single value of ‘2’ (this is the slug, not the ID) and the $taxonomy is the attribute name ‘pa_age’. I’ve also tried using the terms ID number too but this also didn’t appear to work.

    Can anyone shed some light on this for me or point me in the right direction?

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Thread Starter xclamation

    (@xclamation)

    I’m not sure why this wasn’t working previously, I must have made a typo somewhere else in my code but it is now working as expected.

Viewing 1 replies (of 1 total)
  • The topic ‘Deleting product attributes from product (programatically)’ is closed to new replies.