How to hide results when user is in a certain state?

Hello – After looking through the documentation and training for rules, I see that we can set up conditions to hide results based on a user’s country. Is it possible to do this based on the state that they are located in? For instance, if a user’s in the state of California, we’ll hide all products with attribute X.

Is this possible to do? Any advice or documentation would be so helpful. Thank you

Hi @zbevilacqua

Absolutely, with some caveats :slight_smile:

Rules are a general use tool that reads the context you send in, looks for conditions, and then manipulates the result set accordingly.

So a rule can absolutely hide records based on the end-users State, provided you are sending the state information as part of the user context (ruleContexts API parameter | Algolia) and the State information is also a filterable attribute on your records.