Hello to all,
I don’t know if I’m writing in the right section, in case I’m wrong I ask you the courtesy to move the thread, thanks.
I have a question to ask the community:
I need to show in the listings and research only some products compatible with an address that the user will insert in a box on the homepage. What is the correct way to do this development?
Investigating a bit I found these links:
- First question: I understand that I need to create an extension on Vuestorefront API, is this the right way?
- My idea was to do the development like this:
Expose a Magento-side API that returns all salable products based on the user’s address that is passed to them.
Create a Processor as described above in the two links.
Intercept the category listing and search (they probably work the same, but I’m not sure) and delete the results that have a different product_id from those listed in the API response.
Display all products, except those that have been eliminated. If the count of products is zero, show the default component that is displayed when there are no products (maybe this part comes for free).
Is this the correct way? Are there better ways?
I also thought of another way, perhaps “cleaner”, but I still have some doubts about it:
The idea would be to modify the Magento 2 VSBridge Indexer module to report this information (an array containing the zip codes which these products can be shipped to) within the product index. At that point, however, I should just modify the search logic from VSF or VSF API on Elasticsearch of the products. Can you tell me which file would need to be modified (probably extended) to do this?
Which solution is the recommended one?
Thank you all,