An event that triggers when a pricing plan is archived.
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.
function onPlanArchived(event: PlanArchivedEvent): void;
Information about the pricing plan that was archived and metadata for the event.
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixPricingPlans_onPlanArchived(event) {
const planId = event.data.plan._id;
const planDescription = event.data.plan.description;
const eventId = event.metadata.id;
const eventTime = event.metadata.eventTime;
}
/* Full event object:
* {
* "metadata":{
* "id": "3423a637-d7c9-5e44-acb5-337ef4b5d677",
* "entityId": "3455d382-a4c3-7e14-def5-340ad4b5d421",
* "eventTime": "2021-02-03T14:07:13.105207Z",
* "triggeredByAnonymizeRequest": false
* },
* "data": {
* "plan": {
* "_id": "3455d382-a4c3-7e14-def5-340ad4b5d421",
* "name": "Visitor Membership",
* "description": "Temporary membership for visitors from out-of-town",
* "perks": [ ],
* "pricing": {
* "subscription": {
* "cycleDuration": {
* "count": 1,
* "unit": "MONTH"
* },
* "cycleCount": 3
* },
* "price": {
* "value": "20",
* "currency": "USD"
* },
* "freeTrialDays": 0
* },
* "public": false,
* "archived": true,
* "primary": false,
* "hasOrders": true,
* "_createdDate": "2019-06-15T12:53:08.489Z",
* "_updatedDate": "2020-02-03T14:07:13.076Z",
* "slug":"visitor-membership",
* "maxPurchasesPerBuyer": 1,
* "allowFutureStartDate": false,
* "buyerCanCancel" :true,
* "termsAndConditions": "Temporary access for visitors only. Not transferrable."
* }
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.