1

I dont know how can I add multiple words search using magento 2 product api. Example :

https://www.store.com/index.php/rest/V1/products?searchCriteria[pageSize]=8&searchCriteria[filterGroups][0][filters][0][field]=name&searchCriteria[filterGroups][0][filters][0][condition_type]=like&searchCriteria[filterGroups][0][filters][0][value]=%25test%20word%25&searchCriteria[filterGroups][1][filters][0][field]=status&searchCriteria[filterGroups][1][filters][0][condition_type]=eq&searchCriteria[filterGroups][1][filters][0][value]=1&searchCriteria[filterGroups][2][filters][0][field]=visibility&searchCriteria[filterGroups][2][filters][0][condition_type]=eq&searchCriteria[filterGroups][2][filters][0][value]=4

I tried severals things, each time I add a search name with 2 words, it does not return any result.

MAgento 2 API.

0

You need to update your request like below.

https://www.store.com/index.php/rest/V1/products?searchCriteria[filter_groups][0][filters][0][field]=name&searchCriteria[filter_groups][0][filters][0][value]=%25test%25&searchCriteria[filter_groups][0][filters][0][condition_type]=like&searchCriteria[filter_groups][0][filters][1][field]=name&searchCriteria[filter_groups][0][filters][1][value]=%25word%25&searchCriteria[filter_groups][0][filters][1][condition_type]=like&searchCriteria[filterGroups][1][filters][0][field]=status&searchCriteria[filterGroups][1][filters][0][condition_type]=eq&searchCriteria[filterGroups][1][filters][0][value]=1&searchCriteria[filterGroups][2][filters][0][field]=visibility&searchCriteria[filterGroups][2][filters][0][condition_type]=eq&searchCriteria[filterGroups][2][filters][0][value]=4

You need to build your search criteria in OR condition. Let me know if you need further assistance.

Thanks

| improve this answer | |
  • Thanks for your time. I did try that, (I just did again right now). It doesnt work for me. (No result found). – David Jan 28 '19 at 8:26
  • its working for me @David – Ramkishan Suthar Jan 28 '19 at 9:11
  • You were right ! It's working, sorry about it. I did a quick mistake – David Jan 28 '19 at 13:09
  • Great, Happy Coding :) – Ramkishan Suthar Jan 28 '19 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.