Helpcenter +918010117117" [email protected]
B4,309-10 Spaze iTech Park, Sector 49, Sohna Road, 122001 Gurgaon India
call to replace anchor tags contains '/admin' in href


Available in Enterprise Plan and above.

Hooks are useful functions/codes that execute before or after a specific event happens in a store. For example, after a new customer is created, before the product lists or reviews listing, etc.

Adding Hooks

To add a hook in your store, go to the AdvanceSettings > Hooks section in the StoreHippo Admin Panel. Click on the Add New button and the following fields will open up: 


Enter the name of the hook.


Here, you can define the event before or after which the hook will be executed.


Enter the entity name on which the user wants to execute hooks. For example, ms.orders, ms.products, etc.


Enter the entity command on which the user wants to execute hooks. For example, list, add, and many more.


Choose the mode of hooks. Following are the two modes:

1. Prehooks

Prehooks are function/code that is executed before the command handler. Prehooks are executed in order of priority. The highest priority prehooks are executed first and so on.

Example: If you want to list only published products, write a prehook on the list command of the products entity:

function (req, res, next) {
    if (!req.query) {
        req.query = {}
    if (!req.query.filters) {
        req.query.filters = [];
    req.query.filters.push({field: 'publish', value: '1', operator: 'equal'});

2. Posthooks

Posthooksare executed after the command handler.Posthooksare executed in order of priority like prehooks. The highest priority posthooks are executed first and so on.

Example: If you want to send a welcome message to the user after registration, then write aposthookon add command of the user entity.

function (req, res, next) {
    // code to send sms 


Select the action that you want to perform.

Send Mail

Send mail notifications to the customer if a user selects this action.


  • Mailer: Select the mail template that you want to send the user on the execution of this hook.
  • To: Provide email id of the recipient user. This field also supports the handlebar.
  • Attachment Field: User can provide URL or field name in which file is stored.

Execute Handlers

Handler: When you select the handler option, you can add the custom code that will be executed before or after command execution according to the mode.


If multiple hooks are added on a single entity command than this field decides the priority of execution.


Enter the description of the hook.


Select the checkbox, if you want to make the hook inactive. Keep the checkbox unselected to enable the checkbox.

Sort Order

Enter the sort order for the hook. The lower the number, the further up it will display.