Search.../

onPlanArchived( )

Developer Preview

An event that is triggered 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 wixPricingPlans_onPlanArchived(event: PlanArchivedEvent): void

onPlanArchived Parameters

NAME
TYPE
DESCRIPTION
event
Optional
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?

onPlanArchived example

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._id;
7 const planName = event.data.name;
8 const eventTime = event.metadata.eventTime;
9
10 console.log(`The plan, ${planName} with ID ${planId} was archived at ${eventTime}. Full event object:`, event);
11}
12
13/* Full event object:
14 * {
15 * "data": {
16 * "_createdDate": "2024-01-07T07:13:04.076Z",
17 * "_id": "0b9a1993-c1ff-4952-9575-915b48d1a5e0",
18 * "_updatedDate": "2024-01-09T12:32:26.807Z",
19 * "allowFutureStartDate": false,
20 * "archived": true,
21 * "buyerCanCancel": true,
22 * "description": "For new users just getting the feel of the product",
23 * "hasOrders": false,
24 * "maxPurchasesPerBuyer": 0,
25 * "name": "Simple Plan",
26 * "perks": [
27 * "Login member access",
28 * "Access to real-time articles",
29 * "Included in mailing list"
30 * ],
31 * "pricing": {
32 * "price": {
33 * "currency": "USD",
34 * "value": "3"
35 * },
36 * "singlePaymentForDuration": {
37 * "count": 12,
38 * "unit": "MONTH"
39 * }
40 * },
41 * "primary": false,
42 * "public": false,
43 * "slug": "simple-plan",
44 * "termsAndConditions": "I agree to refrain from sharing any of the exclusive content with non-members"
45 * },
46 * "metadata": {
47 * "entityId": "0b9a1993-c1ff-4952-9575-915b48d1a5e0",
48 * "eventTime": "2024-01-09T12:32:26.926390623Z",
49 * "id": "056d1192-470a-4605-9821-c4b7c906c0d1",
50 * "triggeredByAnonymizeRequest": false
51 * }
52 * }
53 */