REST API /rest/V1/products/attributes doesn't distinguish between "Filterable(with results)" and "Filterable(no results)" options #37979
Labels
Evaluated
Issue: ready for confirmation
Progress: done
Reproduced on 2.4.x
The issue has been reproduced on latest 2.4-develop branch
Severity: S2
Major restrictions or short-term circumventions are required until a fix is available.
Short issue description
REST API GET/POST /rest/V1/products/attributes returns the same value for "is_filterable" attribute for both "Filterable(with results)" and "Filterable(no results)" options.
Steps to reproduce
/rest/V1/products/attributes?searchCriteria<sortOrders][0][field]=attribute*group*id&searchCriteria[sortOrders][0][direction]=ASC
Actual results
Expected results
"is_filterable" accepts 3 values for each of the options.### (!) Updated Expected resultsWe can't change 'isfilterable' attribute property type for existing web-api endpoints since it would be a backward incompatible change. So two new web-api endpoints were implemented that allow setting 'isfilterable' attribute property value as an integer: 0 => "No, 1 => "Filterable(with results)", 2 => "Filterable(no results)".
Example:
PUT /rest/V1/products/attributes/is_returnable/is-filterable/2 - return true
GET /rest/V1/products/attributes/is_returnable/is-filterable - return 2
Additional information
Example of the payload for the 'is_returnable' attribute
{{ "is*wysiwyg*enabled": false, "is*html_allowed_on*front": false, "used*for_sort*by": false, "is_filterable": false, "is*filterable_in*search": false, "is*used_in*grid": false, "is*visible_in*grid": false, "is*filterable_in*grid": false, "position": 0, "apply_to": [], "is_searchable": "0", "is*visible_in_advanced*search": "0", "is_comparable": "0", "is*used_for_promo*rules": "0", "is*visible_on*front": "0", "used*in_product*listing": "0", "is_visible": true, "scope": "website", "attribute_id": 177, "attribute*code": "is*returnable", "frontend_input": "select", "entity*type*id": "4", "is_required": false, "options": [ { "label": "Yes", "value": "1" }, { "label": "No", "value": "0" } ], "is*user*defined": false, "default*frontend*label": "Enable RMA", "frontend_labels": [], "backend_type": "varchar", "source_model": "Magento\\Rma\\Model\\Product\\Source", "default_value": "2", "is_unique": "0", "validation_rules": [> }}
The text was updated successfully, but these errors were encountered: