Building a custom filter
The filter uses metafields and session storage to filter products with Shopify’s Search & Discovery app.Session storage
The active filter method. One of
"calendar", "membership", "subscription", or "resale". Set to null to clear all filters and show all products.The selected date range for calendar mode. Only relevant when
filterMode is "calendar".Writing filter state from your own code
Values are stored as JSON strings. Use the helper below to write a key and notify the block — you can inspect the current values at any time in DevTools > Application > Session Storage.Setting a date range (calendar mode)
Reading the current filter state
Global JavaScript hooks
Called each time the collection section re-renders after a filter is applied. Use it to re-initialise third-party scripts or sync a custom UI to the current state. Must be defined before the block initialises.
Shopify metafields
These are the metafields Supercycle uses to power the filter. They are set automatically and can be inspected in Shopify > Settings > Custom data. Product metafieldsThe rental methods available for a product. Values:
Calendar, Membership, Subscription, Resale. Used to filter products by method type.Set to
1 when the variant has stock not yet committed to an active rental. Used by the Membership, Subscription, and Resale filters.Set to
1 when the variant has availability for future dates. Used by the Calendar filter.Example: home page date picker
A date picker in a home page hero that sends customers to the collection page with calendar mode pre-activated. The Methods filter block on the collection page will read the saved sessionStorage state on load and apply the filter automatically.Adding the Methods filter to custom or legacy themes
If your theme doesn’t support app blocks on collection pages, you can add the filter directly to your liquid template.Open your collection template
Go to Online Store → Themes → … → Edit code.
Open one of these files depending on your theme:
sections/main-collection.liquidsections/collection-template.liquidtemplates/collection.liquid
Paste the filter component
Add the snippet below wherever you want the filter to appear — typically above your product grid.
Set the Collection section ID
Find your collection section ID and paste it into the
collections_section_id value. This enables the filter to re-render just the product grid without a full page reload. See the Methods filter setup guide for how to find it.Disable unwanted methods
Set any of
enable_calendar, enable_membership, enable_subscription, or enable_resale to false to hide those filter options.