-
Notifications
You must be signed in to change notification settings - Fork 154
custom attribute not able to see in the product filter section in GraphQl #500
Comments
@TomashKhamlai Thanks for the reply. I updated the bug. |
@cnu115 thank you for reporting this issue. The fix for this issue can be delayed for unknown time period. We acknowledged this issue and added to our product backlog. |
@TomashKhamlai what about filtering for things such as Fashion Material or size, etc? Those attributes are part of |
Would it be easier or faster for us to pass a collection of filters expressed in an EAV structure, rather than a complex filter object? Instead of products(
filter: {
category_id: { eq: "11" }
fashion_material: { eq: "39" } # 39 == cotton, but this fails because fashion_material is not a property of ProductFilterInput
}
) Some alternate products(
filters: [
{ attr_name: "category_id", filter: { eq: "11" }
{ attr_name: "fashion_material", filter: { eq: "39" }
]
) |
@zetlen this is the only reasonable solution imo since some stores genuinely have hundreds of attributes on which we want to filter. We'll be implementing this ourselves, and it simply cannot be |
Zetlen's proposed filter method would fail better as the schema would be less rigid. |
Same issue here, but I also understand that it is nice to have a more fully defined schema. I'm honestly curious if anybody can speak to a general GraphQL "best practice" around this? It seems that having a fully defined schema is generally preferable, but for dynamic fields it seems brittle? Again, I'd be curious to know if this is something that's been discussed at length outside of the Magento GraphQL world? |
@sirugh I understand that @zetlen 's solution would make the schema less rigid. But why is that a bad thing? In a dynamic data model, it's advisable to use an array of objects with the |
I should have provided some substance to my statement but "fail better" is a good thing :D What I meant is that having filter keys by dynamic attributes cause schema failures in the query if the attributes are not present in the schema. If instead we query with known static props on a "query object" the back end can fail more gracefully. That's all I was saying, so not a bad thing :) |
@TomashKhamlai please verify this on |
@sirugh Oh. My bad. Lol |
It looks like I have some good news 🎉 Request:{
productDetail: products(
filter: {
mostselling: {
eq: "1"
}
}
) {
items {
sku
name
price_range {
maximum_price {
regular_price {
currency
value
}
}
minimum_price {
regular_price {
currency
value
}
}
}
mostselling
description {
html
}
}
}
} Response:{
"data": {
"productDetail": {
"items": [
{
"sku": "Simple Product 1",
"name": "Simple Product 1",
"price_range": {
"maximum_price": {
"regular_price": {
"currency": "USD",
"value": 10.51
}
},
"minimum_price": {
"regular_price": {
"currency": "USD",
"value": 10.51
}
}
},
"mostselling": 1,
"description": {
"html": ""
}
}
]
}
}
} @cnu115, could you check if this works for you on 2.3-develop branch? |
Ah, I forgot I applied the https://github.com/magento/devdocs/blob/develop/guides/v2.3/graphql/custom-filters.md |
Fixed in 2.3-develop and 2.4-develop. |
Preconditions (*)
1.Created custom attribute in magento not reflecting on the GraphQl
Steps to reproduce (*)
1.Created custom attribute ( mostselling ) in magento and it was satisfying the layered navigation and able to see in the front magento storefront
2. That ( mostselling ) attribute not reflecting in the product filter GraphQl Query
Expected result (*)
1.We can able to see in the magento front-end .
2.We can able to see error message from GraphQl .
2.
Actual result (*)
1.
The text was updated successfully, but these errors were encountered: