How to update just ONE woocommerce product attribute via API

Viewed 1263

I have a product which has the attributes "Colors" likes this

$productData = [
                                'name' => product name,
                                'type' => 'variable',
                                'sku' => 123,
                                'regular_price' => $row['price'],
                                'attributes' => [
                                    [
                                        'name' => 'Colors',
                                        'visible' => true,
                                        'variation' => true,
                                        'options' => ['red','green','blue'],
                                    ]
                                ]
                            ];

Now what I am trying to do is that I want to update this options array and add a new color here. I didn't find anything in the documentation on how to implement this.

0 Answers
Related