Skip to main content

Show custom menu rows

Store operators configure custom menu rows in Jane: the custom, new_products, and pos_tags row types. This page covers how to identify those rows and fetch their products through the SDK.

Breaking change

Jane is moving away from root_types as the source of truth for which products belong to a menu row. root_types values can clash by name, and some root_types names are reserved for Jane's own use. Row membership now comes from custom_menu_row_ids: unique row ids on the products returned from the SDK and API.

If your category navigation filters on root_types for custom, new_products, or pos_tags rows, switch to custom_menu_row_ids. root_types does not reliably cover these row types. custom_menu_row_ids is the only field that does.

Prerequisites​

  • A Jane partner account with SDK approval and an API key
  • An initialized SDK instance. See Setup & Initialization.

Get the row ID​

Custom menu row ids come from a new endpoint in the Roots Store Operations API. The endpoint below returns the store's custom menu rows in menu order. Each row includes its id, name, menu_row_type, active flag, and schedule. The id is the value you pass to custom_menu_row_ids.

Pass ids[] to return only specific rows, or sort=updated_at&order=desc to find recently changed rows. Menu products from this API also expose custom_menu_row_ids. This API requires the Roots API credential.

GET /roots/store_operations_api/v1/stores/{store_id}/custom_menu_rows

Filter by row​

Pass the row's id in searchFilter to fetchRecommendedSort. The result contains only the products in that row. Full params: Recommended Sort reference.

import { recommendation } from '@iheartjane/dm-sdk';

const placement = await janeDMClient.fetchRecommendedSort({
storeIds: [420],
searchSort: recommendation,
searchFilter: `custom_menu_row_ids:${rowId}`,
searchAttributes: ['product_id', 'name', 'brand', 'image_urls', 'price'],
pageSize: 60,
});

Get per-row product counts​

To get the product count for each row, add custom_menu_row_ids to searchFacets. The counts come back on placement.searchFacets.

const placement = await janeDMClient.fetchRecommendedSort({
storeIds: [420],
searchSort: recommendation,
searchFacets: ['custom_menu_row_ids'],
searchAttributes: ['product_id', 'name', 'brand', 'image_urls', 'price'],
pageSize: 60,
});

placement.searchFacets?.custom_menu_row_ids; // per-row product counts

Sale and best-selling rows​

sale and best_selling are not in custom_menu_row_ids. If you use these row types, root_types is still required for them. Where possible, use fetchFeaturedPlacements for these two rather than faceting on root_types directly.

Rows not available through the SDK​

A row marked roots_only cannot be reached through the SDK. Neither custom_menu_row_ids nor root_types will return it.

Required: wire up tracking​

Every product Jane returns must fire its tracking calls. Fire product.click() on navigation, product.click({ isAddToCart: true }) on add-to-cart, and product.impress() when the card enters the viewport. Read product fields through product.attributes (Product Object). The full tracking contract and a per-page checklist: Event Tracking.

placement.products.map(product => (
<a
key={product.objectId}
href={`/products/${product.attributes.product_id}`}
onClick={() => product.click()}
>
{product.attributes.name}
</a>
))

What's next​