Search.../

onPlanUpdated( )

An event that triggers when a pricing plan is changed.

Description

The onPlanUpdated() event handler runs when a pricing plan has changed. The received PlanUpdatedEvent object contains information about the pricing plan that was updated.

Note: Backend events don't work when previewing your site.

Syntax

function onPlanUpdated(event: PlanUpdatedEvent): void

onPlanUpdated Parameters

NAME
TYPE
DESCRIPTION
event
PlanUpdatedEvent

Information about the pricing plan that was updated and metadata for the event.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event triggered when a pricing plan is changed

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3// Add the file if it doesn't exist.
4
5export function wixPricingPlans_onPlanUpdated(event) {
6 const planId = event.entity._id;
7 const planDescription = event.entity.description;
8 const eventId = event.metadata.id;
9 const eventTime = event.metadata.eventTime;
10}
11
12/* Full event object:
13 * {
14 * "metadata": {
15 * "id": "3743d382-a4d4-7e15-ada5-340ad4b5d760",
16 * "entityId": "c61bbc26-a4d4-7e15-ada5-f99803abce33",
17 * "eventTime": "2021-02-03T10:09:23.194Z",
18 * "triggeredByAnonymizeRequest": false
19 * },
20 * "entity": {
21 * "_id": "c61bbc26-a4d4-7e15-ada5-f99803abce33",
22 * "name": "Full membership",
23 * "description":"Full membership including weekends and holidays",
24 * "perks": [
25 * "Free parking",
26 * "Express line"
27 * ],
28 * "pricing": {
29 * "singlePaymentUnlimited": true,
30 * "price": {
31 * "value": "45",
32 * "currency": "USD"
33 * }
34 * },
35 * "public" : true,
36 * "_createdDate": "2020-01-03T10:13:15.194Z",
37 * "_updatedDate": "2021-02-03T10:09:23.194Z",
38 * "slug":"full-membership",
39 * "maxPurchasesPerBuyer": 1,
40 * "allowFutureStartDate": false,
41 * "buyerCanCancel": true,
42 * "termsAndConditions": "Copyright laws still apply."
43 * }
44 * }
45 */