1

I am using Magento's API to add the Configurable Product Options but I don't see them in Configurable product data.

EndPoint Used to add the Configurable Product Options

https://example.com/rest/default/V1/configurable-products/configurable-product-sku/options/

Payload : {"option":{"attribute_id":"369","label":"Color","values":[{"value_index":54684}]}}

The endpoint I used to get the configurable product

https://example.com//rest/all/V1/products/configurable-product-sku/

Response having the Configurable product option:

"configurable_product_options": [
            {
                "id": 102439,
                "attribute_id": "369",
                "label": "Color",
                "position": 0,
                "values": [],
                "product_id": 2576743
            },

It doesn't have the value saved using the "https://example.com/rest/default/V1/configurable-products/configurable-product-sku/options/" API.

Below is the AP used to get the attribute values, using the attribute set.

API :

https://example.com//rest/default/V1/products/attribute-sets/4/attributes

below is the data for the attribute used :

{
        "attribute_id": 369,
        "attribute_code": "color",
        "frontend_input": "select",
        "entity_type_id": "4",
        "is_required": false,
        "options": [
            {
                "label": " ",
                "value": ""
            },
            {
                "label": "Blanco",
                "value": "54683"
            },
            {
                "label": "Negro",
                "value": "54684"
            },
            {
                "label": "Gris",
                "value": "54685"
            }
        ],
        "is_user_defined": true,
        "default_frontend_label": "Color",
        "frontend_labels": [],
        "backend_type": "int",
        "source_model": "Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Table",
        "default_value": "",
        "is_unique": "0",
        "validation_rules": []
    },

I have followed the below reference to create the configurable product.

https://devdocs.magento.com/guides/v2.4/rest/tutorials/configurable-product/config-product-intro.html

Anyone can help me with this.

1
  • Was this ever resolved? Having the exact same issue. PUT endpoint on the option also doesn't update anything. Seems to be a lack of feedback from the API / a legitimate bug.
    – Juakali92
    Mar 24 at 19:37

1 Answer 1

0

I think you are trying to add the same attribute twice to a product.

{"option":{"attribute_id":"194","label":"color2","position":0,"is_use_default":true,"values":[{"value_index":91},{"value_index":92},{"value_index":93}]}}

i only get an error when executing this request twice. I think you need to look ad updating an existing option. Also, it looks like that the values are only saved if there are child products with that value connected to the parent.

1
  • You can't save a child product until those values exist, so not sure on how you found that?
    – Juakali92
    Mar 24 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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