Home > widget-integration > FilterStorageHelper > saveCollectionIdByHandle

FilterStorageHelper.saveCollectionIdByHandle() method

Saves collection ID mapping by handle to session storage.

Maps collection handles to their numeric IDs for efficient lookup during filter operations. Enables resolving collection IDs from URL handles without additional API calls.

Signature:

saveCollectionIdByHandle(handle: string, value: string): void;

Parameters

Parameter

Type

Description

handle

string

The collection handle (URL-friendly identifier)

value

string

The collection ID (numeric or string)

Returns:

void

Remarks

Collection handles are typically lowercase, hyphenated strings (e.g., 'summer-sale'), while IDs are numeric identifiers.

Example

Override to add analytics tracking:

saveCollectionIdByHandle(handle, value) {
  super.saveCollectionIdByHandle(handle, value);
  // Track collection mapping for analytics
  this.analytics.track('collection_mapped', {
    handle,
    id: value
  });
}