spz-data-source
When to use
spz-data-source provides unified data fetching for products, product lists, collections, and more, distributing results to downstream components (e.g. spz-render, spz-list).
Use it when you need to:
- Centralize data requests on a page and reuse the results
- Provide data to render components via
custom:<id>.getData - Unify access across different data source types (single product, product list, collection, recommendation, etc.)
Supported layout
container
Example
Single product
Product list
Collection
Attributes
Runtime state attributes
Methods
getData
Fetch and return the current data source result. Can be called by other components via custom:<id>.getData.
Returns: Promise<any>
Notes
spz-data-sourcedoes not handle UI rendering on its own; pair it withspz-renderorspz-list.- When a parent
spz-data-sourceexists, child sources try to reuse the parent's data first, reducing duplicate requests. - The
itemsexpression determines the data structure passed to downstream components; keep it consistent with template data access paths.