Skip to content

Subscribe

With data.subscribe you can subscribe to dataset changes. The callback will be called every time, the dataset with the matching id is changed. More information on how to find the unique identifiers can be found in this guide.

Usage:

ts
data.subscribe(
    'sw-product-detail__product',
    ({id, data}) => {
        console.log(data);
    },
    selectors: ['name', 'manufacturer.name'],
);

Parameters

NameRequiredDescription
idtrueThe unique id of the dataset you want to receive
callbacktrueA callback function which will be called every time the Shopware Administration publishes the dataset
selectorsfalseRead more about selectors here