Cannot filter by product name
leoynick opened this issue · 3 comments
Context
Hi, I'm used your platform Spree Commerce. I got a problem when trying to filtered by name. I'm get the response without products. The rest of the filter works fine.
I send this:
createClient().products.list({ filter: { name: "Bolso" } })
/api/v2/storefront/products?filter[name]=bolso
But I receive this:
{ "data": [], "meta": { "count": 0, "total_count": 0, "total_pages": 0 }, "links": { .... } }
Expected Behavior
You should receive the following json ,since the product is in the data among many others.
{
"data": [
{
"id": "2",
"type": "product",
"attributes": {
"name": "Bolso nudos",
"description": null,
"available_on": "2021-08-05T00:00:00.000-05:00",
"slug": "bolso-nudos",
"meta_description": null,
"meta_keywords": null,
"updated_at": "2021-08-11T05:10:35.841-05:00",
"purchasable": true,
"in_stock": true,
"backorderable": true,
"available": true,
"currency": "USD",
"price": "120.00",
"display_price": "$120.00",
"compare_at_price": null,
"display_compare_at_price": null
},
"relationships": {
"variants": {
"data": [
{
"id": "8",
"type": "variant"
}
]
},
"option_types": {
"data": [
{
"id": "2",
"type": "option_type"
}
]
},
"product_properties": {
"data": []
},
"taxons": {
"data": [
{
"id": "3",
"type": "taxon"
}
]
},
"images": {
"data": [
{
"id": "4",
"type": "image"
}
]
},
"default_variant": {
"data": {
"id": "8",
"type": "variant"
}
},
"vendor": {
"data": {
"id": "1",
"type": "vendor"
}
}
}
}
],
"meta": {
"count": 1,
"total_count": 1,
"total_pages": 1
},
"links": {
....
}
}
Your Environment
- Library version: ^4.5.4
- Node and yarn/npm version: Node: v16.6.0 - Yarn: 1.22.10
- Operating system: Big Sur
Hi @leoynick,
The code you provided looks ok. Did you try searching for a different string, like nudos
? What results did you get?
Hi @tniezg,
Yes, with nudos it works fine thank you. But, why doesn't it work with the first word?