1

I've tried many variations of this but cannot seem to be able to add existing tags to an existing product via the api.

I'm currently trying:

$myTagPut = ['tags' => ['id' => 216], ['id' => 222]];
$woocommerce->put('products/'.$prod->id, $myTagPut);

There are no errors of any kind when this runs, but it also isn't adding the tags to the product.

Any help would be much appreciated.

I've also tried just a comma separated list of tag ids, adding all of the tag information (i.e. name, etc.) in the call and nothing seems to work.

1 Answer 1

2

This seems to be a syntax issue as the following code worked:

$myTagPut = ['tags' => [['id' => 216,],['id' => 222,],],];
$woocommerce->put('products/'.$prod->id, $myTagPut);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.