I have a Custom search form with multiple fields on my front page. After clicking on submit button, user would be routed to search result page. (Ideally, a Commerce search view). On search result page, all facets blocks are enabled.

Products are mapped with Commerce Stores (cmp_store). I have used field collection for Store so Seller can add multiple stores. Each store has Zip code associated with it.

I am getting zip code in my search facets. But if User has not entered zip code then I want search result based on User's current location + 25 kms radius. Sorting should be location based.

I guess I have to alter the search query. Not sure how to alter query.

How can I do that ?


I have added related fields to the index configuration page under the "fields" tab. First have added the store then the zip code.

| improve this answer | |

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.