Skip to content

Add to Store

The Add to Store node adds an item to a named user data store for the current user. User stores are per-user collections used for features like favorites, bookmarks, wishlists, and saved items.

Configuration

PropertyTypeDefaultDescription
storeNamestring--Required. The name of the data store (e.g., favorites, wishlist). Only lowercase letters, numbers, and underscores are allowed.
itemIdstring--The item ID to add. If empty, the node extracts id or item_id from the input data.

Input

Accepts any data type. If itemId is not configured, the node looks for id or item_id in the input.

Output

Returns the input data with _stored: true added on success.

json
{
  "id": 42,
  "name": "Widget A",
  "_stored": true
}

If not logged in:

json
{
  "_valid": false,
  "_errors": [{ "field": "_auth", "message": "Login required." }]
}

How It Works

  1. Gets the current user ID. Returns an error if not logged in.
  2. Sanitizes the store name.
  3. Resolves the item ID from config or input.
  4. Executes INSERT IGNORE INTO nexus_user_stores (user_id, store_name, item_id).
  5. The INSERT IGNORE prevents duplicate entries -- adding the same item twice is a no-op.

Example Use Cases

Add to favorites

storeName: "favorites"
itemId: "`{ {input.id}}`"

Wishlist button action

Context --> Require Auth --> Add to Store (storeName: "wishlist") --> Output

Save for later

Context --> Add to Store (storeName: "saved") --> Output

TIP

Pair with Remove from Store for toggle behavior.