#Filter products using custom fields

12 messages · Page 1 of 1 (latest)

arctic forge
#

I have extended the Product Entity, and I want to filter products on the frontend using these custom fields, looks like it doesn't work, do I have to extend something in the backend?

valid flame
#

I wonder the same thing

#

Did you figure it out?

shadow mural
# valid flame Did you figure it out?

you can use patch-package if you use yarn 1 or yarn 3 to patch the medusa package. Add your custom fields to all the products.** files in the patch folder, something like that

valid flame
#

Thanks for the hint. I'd prefer a solution that would allow extending an existing route. After messing around with this for a couple of weeks now, I think the approach to custom attributes in medusaJS is half baken at best. Something that takes minutes in other solutions takes days to figure out properly and it is concerning that patching source code is easier than trying to figure out how to do it properly. This should be much, much simpler.

queen heath
#

please in case you do let us know here

valid flame
#

Unfortunately i can't spend any more time on this. Another option was brought up on GH discussions (using metadata and custom routes instead of attributes on the product entity itself)

#

Since I query and cache server side anyways, I decided to do filtering/pagination there as well until there is a better solution available.

shadow mural
#

If you don't want to patch the package, I think you can create an endpoint on the backend, it is able to retrieve custom fields using list method on the backend

grim ravine