Skip to content

Configurable product links and options creation through Magento REST API 2.4 #37770

Open
@goksasa

Description

@goksasa

Preconditions and environment

  • Magento version 2.4.5

We are trying to update a model through the Magento 2.4 REST API following the official guide published in Create a configurable product using bulk APIs.

Our query is about Defining configurable product options. When creating configurable-product options (POST /rest/default/async/bulk/V1/configurable-products/bySku/options) we are asked to add the values of the options, for example, if the configurable varies by "Color" we add the ids of the corresponding colors, here an example:

[
    {
        "sku": "61784",
        "option": {
            "attribute_id": "684",
            "label": "Golor",
            "position" means 0,
            "values": [
                {
                    "value_index": 11905
                }
            ],
            "is_use_default": true
        }
    }
]

But the result is not as expected, since the option is not created in the attribute configurable_product_options, which appears empty:

"configurable_product_options" : [
            {
                "id": 27296,
                "attribute_id": "684",
                "label": "Golor",
                "position" means 0,
                "values": [],
                "production" means: 47435
            }
        ],

This causes that in step 4, when trying to link variants to the configurable product, the service returns an error saying that it is not possible to do so since configurable does not have those options available:

{
    "operations_list": [
        {
            "id" means 0,
            "status": 3,
            "result_message": "The parent product doesn’t have configurable product options.",
            "error_code": 0
        }
    ],
    "user_type": 1,
    "bulk_id": "bb4a7....",
    "description": "Topic async.magento.configurableproduct.api.linkmanagementinterface.addchild.post",
    "start_time": "2023-07-18 13:53:35",
    "user_id": 2,
    "operation_count": 1
}

On the other hand, I have tried to inform directly configurable_product_options and configurable_product_links in the update of the model JSON body and in this case it has worked fine, although this way is not valid since configurable_product_links requires us to inform the ids of the products, which makes it unfeasible for bulk use, but gives us a hint that it may be necessary to report both somehow at the same time.

Does anyone faced this issue and knows if there is any solution or workaround?

Best regards!

Steps to reproduce

Create product options through POST /async/bulk/V1/configurable-products/bySku/options.

Link simple product to configurables through POST /async/bulk/V1/configurable-products/bySku/child.

Expected result

Product options are created successfully.

Actual result

Configurable product options is created but options values array is empty:

"extension_attributes": {
        "configurable_product_options": [
            {
                "id": 27297,
                "attribute_id": "684",
                "label": "Color",
                "position": 0,
                "values": [],
                "product_id": 47435
            }
        ]
    }

So when trying to link simples to configurables an error ocurrs:

{
    "operations_list": [
        {
            "id": 0,
            "status": 3,
            "result_message": "The parent product doesn't have configurable product options.",
            "error_code": 0
        }
    ],
    "user_type": 1,
    "bulk_id": "bb4a73f0-695b-44d9-b286-00e9fba64cf1",
    "description": "Topic async.magento.configurableproduct.api.linkmanagementinterface.addchild.post",
    "start_time": "2023-07-18 13:53:35",
    "user_id": 2,
    "operation_count": 1
}

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions