makePlanPrimary( )


Marks a pricing plan as the primary pricing plan.

The makePlanPrimary() function returns a Promise that resolves to the now primary pricing plan.

Only a single plan can be marked as a primary plan at any given time. If there is an existing plan marked as primary, calling makePlanPrimary() causes the existing primary plan to lose its primary status.

When viewing pricing plans on the site, the primary plan is highlighted with a customizable ribbon.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Pricing Plans
Learn more about app permissions.
Method Declaration
Copy
function makePlanPrimary(_id: string): Promise<MakePlanPrimaryResponse>;
Method Parameters
_idstringRequired

ID of the pricing plan to set as the primary plan.

Returns
Return Type:Promise<MakePlanPrimaryResponse>
JavaScript
import { plans } from "wix-pricing-plans.v2"; /* Sample _id value: '0b9a1993-c1ff-4952-9575-915b48d1a5e0' */ export async function myMakePlanPrimaryFunction(_id) { try { const primaryPlan = await plans.makePlanPrimary(_id); return primaryPlan; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "_id": "b20feb39-a452-453e-96ee-01036adcd04e", * "_createdDate": "2024-01-07T07:33:59.973Z", * "_updatedDate": "2024-01-07T13:32:11.263Z", * "allowFutureStartDate": false, * "archived": false, * "buyerCanCancel": true, * "description": "Full feature enablement - lifetime plan", * "formId": "ee62cefa-bdc2-4b5d-baab-6faeef83cecb", * "hasOrders": false, * "maxPurchasesPerBuyer": 0, * "name": "Premium Plan - Lifetime Membership", * "perks": { * "values": [ * "Cloud drive and file upload services", * "Unlimited video content access" * ] * }, * "pricing": { * "price": { * "currency": "EUR", * "value": "1000" * }, * "singlePaymentUnlimited": true * }, * "primary": true, * "public": true, * "slug": "premium-plan-lifetime-membership", * "termsAndConditions": "This plan allows unlimited app and site features usage for all time, subject to our fair usage agreement and basic human decency agreement." * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?