1

I am trying to create simple product with custom option(Field type) using rest api but custom option is not saving with product endpoint rest/V1/products.

request body

    {
    "product": {
        "sku": "test_simple_product3",
        "name": "Test Simple Product",
        "attribute_set_id": 4,
        "price": 25,
        "status": 1,
        "visibility": 1,
        "type_id": "simple",
        "weight": "0.5"
    },
    "custom_attributes": [
        {
            "attribute_code": "has_options",
            "value": 1
        },
        {
            "attribute_code": "required_options",
            "value": 1
        }
    ],
    "options": [
        {
            "product_sku": "test_simple_product3",
            "title": "Add Your Name (Max 15 Characters)",
            "type": "field",
            "sort_order": 1,
            "is_require": false,
            "price": 10,
            "price_type": "fixed",
            "sku": "Personalized",
            "max_characters": 15
        }
    ]
  
}

1 Answer 1

2

Try this payload instead:

{
   "product":{
      "sku":"test_simple_product3",
      "name":"Test Simple Product",
      "attribute_set_id":4,
      "price":25,
      "status":1,
      "visibility":1,
      "type_id":"simple",
      "weight":"0.5",
      "custom_attributes":[
         {
            "attribute_code":"has_options",
            "value":1
         },
         {
            "attribute_code":"required_options",
            "value":1
         }
      ],
      "options":[
         {
            "product_sku":"test_simple_product3",
            "title":"Add Your Name (Max 15 Characters)",
            "type":"field",
            "sort_order":1,
            "is_require":false,
            "price":10,
            "price_type":"fixed",
            "sku":"Personalized",
            "max_characters":15
         }
      ]
   }
}
0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.