User Preferences

In this guide, you'll learn about user preferences in the Settings Module.

What is a User Preference?#

A user preference stores an arbitrary setting for a user as a key-value pair. For example, you can store a user's preferred theme or language.

The UserPreference data model represents a user preference. It denotes the user it belongs to through the user_id property, and it stores the setting's key and value in its key and value properties. A user can have only one preference per key.


Manage User Preferences#

The Settings Module's service provides methods to create, retrieve, update, and delete user preferences. Resolve the service from the Medusa container using Modules.SETTINGS.

Internal Usage#

The Settings Module uses user preferences internally to track a user's active view for an entity and active layout scope for a zone.

Learn more about these concepts in the View Configurations and Layout Configurations documents.

Found a problem with this page?Report Issue
Edited Nov 14·Edit this page