Window Nimstrata Properties

window.Nimstrata is the storefront configuration object read by Nimstrata App Block JavaScript.

For normal Online Store 2.0 installs, Shopify Liquid App Blocks create the required values from app settings, Shopify localization data, and app metafields. For Online Store 1.0 installs, first enable Enable translations on 1.0 themes in the Core Components App Embed. Add custom window.Nimstrata properties only for a bespoke theme integration that cannot be configured in the Retail Cloud Connect Shopify App.

Define any manual values before loading the Nimstrata storefront bundle.


Property Reference

Property Used by Purpose
window.Nimstrata.settings Search, collection, recommendations Overrides saved storefront settings such as product-card layout, filter layout, fields, and order settings. Prefer the Retail Cloud Connect Shopify App UI for Online Store 2.0.
window.Nimstrata.placeId Search, collection Sets the active local-inventory place before the storefront bundle loads.
window.Nimstrata.setPlaceId Search, collection Changes or clears the active local-inventory place at runtime and refreshes mounted Search and Product Grid App Blocks.
window.Nimstrata.search.defaultFilters Search, collection Hidden filters appended to each search/browse request. Accepts an array or a sync/async function returning an array.
window.Nimstrata.search.customFilters Search, collection Visible custom switch filters that can render in the toolbar or filter drawer.
window.Nimstrata.search.customFields Search, collection Extra fields to request for custom-filter relevance checks when the field is not a normal App Block filter.
window.Nimstrata.search.filterVisibilityRules Search, collection Bespoke client-side rules that hide or force-show normal App Block facets and clear their active values when hidden.
window.Nimstrata.search.gridContent Search, collection Places Liquid-rendered templates or Web Components between product cards by product position and grid span.
window.Nimstrata.search.setGridContent Search, collection Replaces gridContent and updates mounted grids after the storefront bundle has loaded.
window.Nimstrata.search.keyMappings Search, collection Maps legacy URL parameters to App Block filter fields. See Keep Existing Links Working.
window.Nimstrata.recs.defaultFilters Recommendations Hidden filters appended to recommendation predict requests. The recommendations block adds an in-stock filter unless an availability filter is provided.
window.Nimstrata.hooks.postProductRender Search, collection Optional callback invoked after product cards re-render. Use only for legacy scripts that must attach to rendered product-card DOM.
window.Nimstrata.t.searchButtonInner Search, collection Optional HTML override for the search button inner content in manual installs. Prefer App Block translations and CSS for normal installs.
window.Nimstrata.translations.default App Blocks Flat storefront translation dictionary for UI copy and filter headings. Online Store 2.0 App Blocks inject this automatically.
window.Nimstrata.translations.filters Search, collection Per-facet filter-value translations. Online Store 2.0 App Blocks inject this automatically.
window.Nimstrata.translations.document Document search Document-search UI translations. Online Store 2.0 App Blocks inject this automatically.
window.Nimstrata.filterOrder Search, collection Optional per-facet comparator functions for custom filter-value ordering.
window.Nimstrata.project Autocomplete Google Cloud project name for manual autocomplete installs. App Blocks set this from app metafields.
window.Nimstrata.language Autocomplete Shopify storefront language code for manual autocomplete installs.
window.Nimstrata.country Autocomplete Shopify storefront country code for manual autocomplete installs.
window.Nimstrata.token Autocomplete Shopify Storefront API token when Shopify autocomplete tracking is enabled.
window.Nimstrata.identity Autocomplete, search Store identity, normally the shop permanent domain or its prefix depending on the block.

Local Inventory Place

Set the Shopify location ID before loading the storefront bundle when the page already knows the shopper's active place:

window.Nimstrata = window.Nimstrata || {};
window.Nimstrata.placeId = '75095408826';

After the bundle loads, change the place with window.Nimstrata.setPlaceId('75095408826') or clear it with window.Nimstrata.setPlaceId(null). The setter persists or clears the first-party functional rcc-place-id cookie and makes mounted Search and Product Grid App Blocks refetch.

Each changed value emits a public event on window. Setting a place emits retail-connect:place:set with { placeId, previousPlaceId }; clearing it emits retail-connect:place:removed with { placeId }, where placeId is the removed value. Repeating the current value does not emit an event.

window.addEventListener('retail-connect:place:set', ({ detail }) => {
  console.log('Place set', detail.placeId);
});

window.addEventListener('retail-connect:place:removed', ({ detail }) => {
  console.log('Place removed', detail.placeId);
});

On page load, a non-empty window.Nimstrata.placeId takes precedence over the decoded rcc-place-id cookie. Search and collection requests send the active value as top-level placeIds: [placeId].

For locations selected in the Shopify app's Local Inventory settings, the filter displays a smaller, regular-weight Local Store row above the saved storefront display name. Change Store uses the same position, size, and colour as the filter's normal Clear action. The local-inventory filter does not show a separate Clear action. Clicking Change Store keeps the active place and selected local fulfillment values until an integration calls setPlaceId with a new place, and closes the surrounding native filter dialog. The display name defaults to the Shopify Admin location name and can be edited without changing the location itself. If the active place has no saved name, the heading is the single normal-size Local Store fallback.

The action is visible by default. A bespoke integration can hide it without discarding saved place names:

window.Nimstrata = window.Nimstrata || {};
window.Nimstrata.settings = window.Nimstrata.settings || {};
window.Nimstrata.settings.localInventory = {
  ...window.Nimstrata.settings.localInventory,
  showChangeStoreButton: false,
};

Manual Search Example

<script>
  window.Nimstrata = window.Nimstrata || {};
  window.Nimstrata.search = window.Nimstrata.search || {};

  window.Nimstrata.search.defaultFilters = [
    {
      field: 'attributes.available_in_market',
      value: ['GB'],
      type: 'string',
    },
  ];

  window.Nimstrata.search.customFilters = [
    {
      name: 'in_stock',
      displayName: 'In stock',
      displayComponent: 'switch',
      displayLocation: 'toolbar',
      filter: {
        field: 'availability',
        value: ['IN_STOCK'],
        type: 'string',
      },
    },
  ];
</script>

When a mapped Shopify filter URL contains a Metaobject GID value, the Search or Product Grid App Block resolves it to storefront display text before applying keyMappings. For example, gid://shopify/Metaobject/182167241028 can become Tinted. The lookup is made only when such a GID is present and requires the App Block's Storefront token to have metaobject access; otherwise the original value is retained.


Manual Conditional Filter Visibility Example

Use filterVisibilityRules only for bespoke storefront behavior that cannot be configured as a normal App Block filter or layout setting. Rules must be defined before the Search Results or Product Grid App Block starts.

window.Nimstrata = window.Nimstrata || {};
window.Nimstrata.search = window.Nimstrata.search || {};

window.Nimstrata.search.filterVisibilityRules = [
  {
    field: 'attributes.series',
    visibleWhen: ({ getFacetValues, getFilterValues }) => {
      const selectedBrands = getFilterValues('brands');

      if (selectedBrands.length > 0) {
        return selectedBrands.length === 1;
      }

      return getFacetValues('brands').length === 1;
    },
  },
];

This example renders the attributes.series filter only when exactly one brand is selected or exactly one brand is available in the current result set. If the shopper later selects multiple brands, the App Block hides attributes.series and removes any selected series values.

For promotions, ads, or editorial content between product cards, see Content Inside Search and Collection Grids. That guide covers Liquid templates, Web Components, spans, placement, pagination, and runtime updates.


Manual Translation Example

Use this only for manual installs that cannot use the Retail Cloud Connect Shopify App Translations page.

window.Nimstrata = window.Nimstrata || {};
window.Nimstrata.translations = window.Nimstrata.translations || {};

window.Nimstrata.translations.default = {
  'search.placeholder': 'Search',
  'toolbar.refine_filters': 'Refine Filters',
  brands: 'Brand',
};

window.Nimstrata.translations.filters = {
  sizes: {
    sizes: 'Size',
    Small: 'Small',
    Medium: 'Medium',
    Large: 'Large',
  },
};

Manual Recommendation Example

window.Nimstrata = window.Nimstrata || {};
window.Nimstrata.recs = window.Nimstrata.recs || {};

window.Nimstrata.recs.defaultFilters = [
  {
    field: 'attributes.available_in_market',
    value: ['GB'],
    type: 'string',
  },
];

When no availability filter is provided, recommendations add { field: 'availability', value: ['IN_STOCK'], type: 'string' } automatically.


Safer Alternatives

Before adding custom JavaScript, check whether the app already covers the need: