Search...
onVariantsUpdated( )
An event that fires when variant information for a product is updated.
Description
The onVariantsUpdated()
event handler runs when variant information for a product
is updated in a store.
Note: Backend events don't work when previewing your site.
Syntax
function onVariantsUpdated(event: VariantsUpdatedEvent): void
onVariantsUpdated Parameters
NAME
TYPE
DESCRIPTION
event
VariantsUpdatedEvent
Information about the product collection that was deleted.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
An event when a product variant information is updated
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.34export function wixStores_onVariantsUpdated(event) {5 let productId = event.productId;6 let firstVariant = event.variants[0];7}89/* Full event object:10 *11 * {12 * "variants":[13 * {14 * "updatedFields":[15 * "price"16 * ],17 * "choices":{18 * "Color":"Red"19 * },20 * "variantId":"00000000-0000-0001-0005-970d993bafe9"21 * }, {22 * "updatedFields":[23 * "sku"24 * ],25 * "choices":{26 * "Color":"Blue"27 * },28 * "variantId":"00000000-0000-0002-0005-970d993bafe9"29 * }30 * ],31 * "productId":"1a2d7e83-4bef-31d5-09e1-3326ee271c09"32 * }33 *34 */