"Product option changed" event
Ecwid.OnProductSelectedOptionsChanged
Track selected options changes for the currently opened product.
Any option change creates a snapshot of all product options and their currently selected values. Callback from this method allows you to get snapshots before and after the option change alongside the product ID.
Code example:
Ecwid.OnProductSelectedOptionsChanged.add((payload) => {
console.log(payload.productId);
console.log(payload.previousOptions);
console.log(payload.newOptions);
});
// prints
// {
// "productId":689454040,
// "previousOptions":{"Size":"32"},
// "newOptions":{"Size":"32","Color":"Black"}
// }Payload values:
Field
Type
Description
productId
number
Customer's email.
previousOptions
object
JSON object with previously selected options, where all option names and values are stringified.
newOptions
object
JSON object with currently selected options, where all option names and values are stringified.
Last updated
Was this helpful?
