I am having a project using Magento rest API V1, I have read through the documentation and looking for the answer around the web but cannot find the solution.
** First: **
I want to show list of configurable products and user will select the size before adding to cart, I am using :
{{domain}}/rest/V1/products?searchCriteria[filterGroups][0][filters][0][field]=has_options&searchCriteria[filterGroups][0][filters][01][value]=1&searchCriteria[pageSize]=10
**The response I get: **
{
"items": [
{
"id": 1,
"sku": "AA0001",
"name": "Sample Product",
"attribute_set_id": 1,
"price": 0,
"status": 1,
"visibility": 4,
"type_id": "configurable",
....
},
....
]
}
The problem is the price is 0, and I only want to show configurable product list.
** Second: **
I want to do a filter by size, color and another attribute for a specific category, how can I get a list of available attributes by category?
Like category_id = 1 and show what sizes are available only for that category.
Thanks in advance
Best Answer
I know it's an old question, but I hope someone would find it useful.
You need to use another endpoint to get the configurable product price.
Each product children might be having their own price.
So you need to find a lower price or any reasonable way from the children to display the configurable product price in a category list. Also in default product detail display.
Because each product children might be having different price. You need to get the correct price based on the selected configurable product options.
You can see all the options below the "extension_attributes" -> "configurable_product_options" property or using below endpoint :
To display the options correct values, you need to get all available product attributes using below endpoint :
Then display the options based on the "configurable_product_options" property.