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

Commands and Hooks

All entities have standard commands that are used to perform standard CRUD operations.

Standard Commands

Following are standard commands that are available by default to all global or store entities.

  • get 
  • list
  • add
  • edit
  • delete
  • duplicate
  • import
  • export

Custom Commands

Custom commands are available only in Enterprise plan.

Apart from standard commands, the user can create custom commands for any entity. 

Adding a custom command

To create a custom command for an entity, please follow these steps:

  • Go to Advance Settings > Entities in StoreHippo Admin Panel.
  • Search the entity to which you want to add the command.
  • Click on the edit button.
  • On the edit page, go to Commands tab.

<Image for commands tab will go here>

Click on Add New button. A form will appear with following fields:


Enter the name of the command


Enter the HTTP method that can be used for the command. Possible values are:

  • GET
  • POST
  • PUT


Handler is the function that gets executed when the command is called.  Please refer to the section below on how to write command handlers.


Select the roles that have permission to call this command.

Extending standard commands

Hooks can be used to extend the behaviour of standard commands. There are two types of hooks

Pre Hooks

pre hooks are executed before the command handler. If there are multiple pre hooks then they are executed in the order of priority.

Post Hooks

Post hooks are executed after the command is executed. If there are multiple pre hooks then they are executed in the order of priority.

Writing Command Handlers and Hooks

Both command handlers and hooks follow the same middleware syntax which looks as follows:

function(req, res, next) {



Request contains the information about the request that is available in the handlers and hooks.

filters Array of filters to apply when listing records
q (deprecated) Filters in the form of an object with name value pair
sort Pass the fields that you want to sort eg. '-price'
since_id If you want to get the records since a specific record id
entity Entity for which this command was triggered
command The command name that was triggered
resourceId The id of the record for which command is triggered (optional)
headers Contains the request headers. You can use the headers to determine if the request is from storefront or backend e.g. req.headers.frontend == '1' or req.headers.backed == '1'
user contains details about the current user.

device contains details about the current device
substore contains details about current substore
app is the internal SDK that you can use to call other entity commands/microservices.
settings contains the current store settings


send(data) will stop the execution and return the control from the current handler/hook. It will also stop the execution of any subsequent handler/hooks.
error(data) will stop execution and also return error
next() will return control from current handler but enable execution of subsequent handlers/hooks.


Adding Record 

let product_id = await"ms.products", {name: 'test', price: 10});

Editing Record

await"ms.products", '62999791c1ce4e288076d4da' {name: 'test', price: 10});

Delete Record

await"ms.products", '62999791c1ce4e288076d4da');

list Records

let records = await"ms.products");

let records = await"ms.products", { filters: [{field: 'alias', value: 'test'}] });

let record = await"ms.products", { filters: [{field: 'alias', value: 'test'}] });

Get Record

let record = await"ms.products", '62999791c1ce4e288076d4da');