I have created a custom field "Plan Identifier" in custom option for products. enter image description here

Now, I want this field to be updated when we create a product using REST API and also the data of this filed when we make a GET request. I tried to send this in the payload:

  "product": {
    "sku": "prod-111",
    "name": "abcd", 
    "attribute_set_id": 4,
    "price" : 400,
    "options": [
            "product_sku": "prod-111",
            "title": "Rental Plan",
            "plan_identifier": "some Data",
            "is_require" : true,
            "sort_order" : 4,
            "values": [
                    "title": "Half Day Plan",
                    "price": 0,
                    "price_type" : "fixed",
                    "sku": "drop_down option 1 sku",
                    "sort_order": 1
                    "title": "Full Day Plan",
                    "price": 50,
                    "price_type" : "fixed",
                    "sku": "drop_down option 1 sku 1",
                    "sort_order": 2
            "extension_attributes": {
                "plan_identifier": "new data"

Then I created a beforeSave plugin to save this data. I tried using extension attribute too but nothing works. Here is the error I am getting:

"message": "Property \"PlanIdentifier\" does not have accessor method \"getPlanIdentifier\" in class \"Magento\\Catalog\\Api\\Data\\ProductCustomOptionExtensionInterface\".",

Please suggest the correct way of doing it and help me.


Your Answer

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