Search.../

onPlanArchived( )

An event that triggers when a pricing plan is archived.

Description

The onPlanArchived() event handler runs when a pricing plan is archived. The received PlanArchivedEvent object contains information about the pricing plan that was archived.

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

Syntax

function onPlanArchived(event: PlanArchivedEvent): void

onPlanArchived Parameters

NAME
TYPE
DESCRIPTION
event
PlanArchivedEvent

Information about the pricing plan that was archived 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 archived

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_onPlanArchived(event) {
6 const planId = event.data.plan._id;
7 const planDescription = event.data.plan.description;
8 const eventId = event.metadata.id;
9 const eventTime = event.metadata.eventTime;
10}
11
12/* Full event object:
13 * {
14 * "metadata":{
15 * "id": "3423a637-d7c9-5e44-acb5-337ef4b5d677",
16 * "entityId": "3455d382-a4c3-7e14-def5-340ad4b5d421",
17 * "eventTime": "2021-02-03T14:07:13.105207Z",
18 * "triggeredByAnonymizeRequest": false
19 * },
20 * "data": {
21 * "plan": {
22 * "_id": "3455d382-a4c3-7e14-def5-340ad4b5d421",
23 * "name": "Visitor Membership",
24 * "description": "Temporary membership for visitors from out-of-town",
25 * "perks": [ ],
26 * "pricing": {
27 * "subscription": {
28 * "cycleDuration": {
29 * "count": 1,
30 * "unit": "MONTH"
31 * },
32 * "cycleCount": 3
33 * },
34 * "price": {
35 * "value": "20",
36 * "currency": "USD"
37 * },
38 * "freeTrialDays": 0
39 * },
40 * "public": false,
41 * "archived": true,
42 * "primary": false,
43 * "hasOrders": true,
44 * "_createdDate": "2019-06-15T12:53:08.489Z",
45 * "_updatedDate": "2020-02-03T14:07:13.076Z",
46 * "slug":"visitor-membership",
47 * "maxPurchasesPerBuyer": 1,
48 * "allowFutureStartDate": false,
49 * "buyerCanCancel" :true,
50 * "termsAndConditions": "Temporary access for visitors only. Not transferrable."
51 * }
52 * }
53 * }
54 */