...
When the visualizer opens, you must send the current status of the Favorites section to the web-visualizer to synchronize selected products by calling the event window.postMessage described below:
Code Block | ||
---|---|---|
| ||
// first option window.frames.wizartFittingRoom.onload = (() => { window.frames.wizartFittingRoom.postMessage({ eventName: 'setFavoritesStore', payload: ['vendor_code_1', 'vendor_code_2'], }, '*'); }); or // second option window.addEventListener('message', (event) => { if (event.data && event.data.eventName === 'iframeLoaded') { window.frames.wizartFittingRoom.postMessage({ eventName: 'setFavoritesStore', payload: ['vendor_code_1', 'vendor_code_2'], }, '*'); } }, false); |
where you should send list of vendor codes (or Unique SKU ID-es) within payload
. Note: wizartFittingRoom
is iframe’s name.
...