Hi Team,
Installed the Search and Discovery app in the store and wanted to do some customization in it. For now, it is working on a boolean approach, Such as Selecting the Chicken filter option will show Chicken products, and Selecting the Chicken and Turkey filter option will show products that contain meta filed value Chicken and Turkey.
As a stretch - would you suggest a way we could select Turkey and it also shows Chicken and Turkey products because it is contained in it? Will it be possible, if yes then what condition do I need to apply?
Thanks
Hello @Vandana_Roy91 ,
Yes, it is possible to show both Chicken and Turkey products when a user selects only the “Turkey” filter. Here’s how you can achieve this with a slight adjustment to the current logic:
Current Logic (Boolean):
- Selecting “Chicken” filter shows Chicken products (meta field value = “Chicken”).
- Selecting “Chicken and Turkey” filter shows products with both values (meta field value = “Chicken and Turkey”).
New Logic (Inclusive):
- Selecting “Turkey” filter shows products with “Turkey” in the meta field value (including “Chicken and Turkey”).
Condition to Apply:
Instead of a strict boolean match, use a search that looks for products where the meta field value contains the term “Turkey.” Here’s how it might look depending on your specific app:
- Example 1 (if your app supports wildcard searches):
meta_field_value:*Turkey*
This will find any product where the meta field value contains “Turkey,” including “Chicken and Turkey.”
- Example 2 (if your app uses regular expressions):
meta_field_value=Turkey|Chicken and Turkey
This uses a regular expression to match either “Turkey” or “Chicken and Turkey.”
Benefits:
- This approach provides a more user-friendly experience by showing all relevant products even if the user selects a specific sub-category (Turkey) within a larger category (Chicken and Turkey).
Implementation:
- Consult your app’s documentation for specific instructions on implementing wildcard searches or regular expressions within the filter criteria.
Additional Notes:
- If your app offers a way to categorize products hierarchically (e.g., Chicken and Turkey as a sub-category of Poultry), that might be a more robust solution in the long run.
- Make sure to test the new logic thoroughly to ensure it works as expected before deploying it to your live store.
By implementing this change, your client’s store will provide a more intuitive and convenient shopping experience for users browsing poultry products.