If your site has Salesforce integration enabled to connect it to your Salesforce instance, you can restrict access to a given product so that only logged in users whose Contact record has a field matching a value of your choosing may view and purchase the product.
This restriction will be true of all Stores which include the product.
To do so:
- In the administrator, Navigate to the Shops Manager
- Click Products Manager
- Open the product you wish to restrict
- For Custom Field, enter the API Name of the Salesforce field you are choosing as ($ApiName}.
To locate the API Name for the field on your Contact object in Salesforce, go to Setup > Customize > Contacts > Field Names. If it is a standard field in the Contact Standard Fields list at the top, you may use the Field Name in the middle column of this view. If it is a custom field in the Contact Custom Fields & Relationships list further down, use the API Name in the second column and be sure to include the "__c" suffix that Salesforce appends to all custom fields.
- For Custom Field Value, enter the value you wish to match. Any record whose field includes the value will be given access to this product. For example, if you specify "business" as the value, any Contact whose Custom Field has the value of "Small Business" will be granted access.
NOTE: The value entered will be a match with any Contact whose field contains the string you enter. For instance, if you are using a text field and enter the Custom Field Value as "Nonprofit", Contacts with field values of, say, "Social Service Nonprofit", "Nonprofit Association" and "Nonprofit" will match and be given access to this product.
This is also true of a mutl-select picklist. If the aforementioned three options are picklist items, any Contact with any of them selected would be given access to a product whose Custom Field Value is "Nonprofit".
- Click Save