The validation of the product links attributes from the configurable-product module is not type-safe which leads to a validation error when the value is (int)0
See: https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/ConfigurableProduct/Model/Plugin/ProductRepositorySave.php#L103
when it's confirmed I can provide a small pr just making the validation type safe or using the more suited hasData() here
update: it does not happen when saving the product in the backend because the problem is in a Plugin on the ProductRepository which is not used for saving the Product in the Adminhtml Save Controller
update: also some interesting behavior / bug: if you update the product via PUT request and do not specify type_id: configurable in the payload, the validation is not triggered since the product is not considered a configurable product here: https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/ConfigurableProduct/Model/Plugin/ProductRepositorySave.php#L60
Hi @davidverholen
We can not reproduce the issue as you describe.
Please share an install script, how do you add the attribute and share you api request.
Thanks
Ok, I've created a small module config-bug.tar.gz
{
"product": {
"sku": "config",
"name": "config",
"status": 1,
"type_id": "configurable",
"attribute_set_id":4,
"extension_attributes": {
"configurable_product_options": [
{
"attribute_id": 133,
"label": "New Attribute",
"values": [
{
"value_index": "0"
}
]
}
],
"configurable_product_links":[
1
]
}
}
}
Result:
{"message":"Product with id \"%1\" does not contain required attribute \"%2\".","parameters":["1","new_attribute"]}
while the catalog_product_entity_int table also contains the correct value 0 for the attribute
@davidverholen, thank you for your report.
We've acknowledged the issue and added to our backlog.
found this behavior in 2 more places: (since for some reason empty("0") evaluates to true in php):
When adding a product to cart with a "0" configuration chosen:
https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php#L857
When having a product in cart with a "0" configuration chosen
https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php#L955
as a first step, I think, it would be useful to extract the validation logic for the configurable options
Hello @davidverholen
Could you please create PR with fix for this issue to 2.4-develop?
Thank you in advance!
at the time I created this issue the validation was implemented in several places (instead of one central class for that responsibility).
Tbh I'm not sure if this is still an Issue, but if so, it should be fixed.
Unfortunately, currently I do not have the time to investigate further.
So it would be nice if someone could fix that
Hi @engcom-Alfa. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.[ ] 2. Verify that the issue is reproducible on 2.4-develop branchDetails
- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.
Issue reproduced on the fresh 2.4-develop instance according to the steps, described in comment
Actual Result:

:white_check_mark: Confirmed by @engcom-Alfa
Thank you for verifying the issue. Based on the provided information internal tickets MC-30199 were created
Issue Available: @engcom-Alfa, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._
Hi @engcom-Charlie. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.2.4-develop branch@magento give me 2.4-develop instance to deploy test instance on Magento infrastructure. 2.4-develop branch, please, add the label Reproduced on 2.4.x.Hi @davidverholen. Thank you for your report.
The issue has been fixed in magento/magento2#29001 by @engcom-Charlie in 2.4-develop branch
Related commit(s):
The fix will be available with the upcoming 2.4.1 release.