0

I want to add an attribute to a product using rest api. I have created the attribute but not added to the product.

How can i add it to respective product using rest api?

2
  • How did You added the attribute to product @avesh Commented Jun 15, 2018 at 15:49
  • I created attribute in using store->attribute->product Commented Jun 15, 2018 at 15:59

1 Answer 1

0

Never mind i found the solution.

           $data = array(
                "product" => array(
                    'custom_attributes' => array(
                        array( 'attribute_code' => 'useful',   
                           'value' => 1),
                    ),
                )
            );

            $apiClient->put("products/".$product->sku, $data);

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.