makePlanPrimary( )
Marks a pricing plan as the primary pricing plan.
Description
The makePlanPrimary()
function returns a Promise that resolves to the
pricing plan that is now the primary one.
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 status.
When viewing pricing plans on the site, the primary plan is highlighted with a customizable ribbon.
Only users with "Manage Pricing Plans" permissions can mark a plan as a primary plan.
Syntax
function makePlanPrimary(id: string): Promise<Plan>
makePlanPrimary Parameters
NAME
TYPE
DESCRIPTION
ID of the plan to be set as the primary plan.
Returns
Fulfilled - The primary plan.
Return Type:
NAME
TYPE
DESCRIPTION
Plan ID.
Plan name.
Plan description.
List of text strings that promote the pricing plan (for example, "Plenty of parking" or "Free gift on your birthday").
Plan price, payment schedule, and expiration.
Whether the plan is public (visible to site visitors).
Whether the plan is archived. Archived plans are not visible and can't be purchased anymore, but existing purchases remain in effect.
Whether the plan is marked as primary. If true
, the plan is highlighted on the site with a custom ribbon. Defaults to false
.
Whether the plan has any orders (including pending and unpaid orders).
Date plan was created.
Date plan was last updated.
URL-friendly version of the plan name. Unique across all plans in the same site.
Whether the buyer can start the plan at a later date.
Whether the buyer is allowed to cancel their plan. If false
, calling the cancelOrder()
function returns an error.
Whether the same buyer can purchase the plan multiple times. 1
means the buyer can only purchase the plan once. An empty value or 0
means no limitation.
Any terms and conditions that apply to the plan. This information is displayed during checkout.
Related Content:
Was this helpful?
Make a plan a primary plan
1import wixPricingPlansBackend from 'wix-pricing-plans-backend';23export function myMakePlanPrimaryFunction() {4 const planId = '3743d382-a4d4-7e15-ada5-340ad4b5d760';56 return wixPricingPlansBackend.makePlanPrimary(planId)7 .then((plan) => {8 console.log(plan);9 })10 .catch((error) => {11 console.error(error);12 });13}1415/* Full plan object - primary is true:16 *17 * {18 * "plan": {19 * "_id": "3743d382-a4d4-7e15-ada5-340ad4b5d760",20 * "name": "Ultimate",21 * "description": "The ultimate gaming experience",22 * "perks": [23 * "There are no words to describe this extreme game",24 * "Easy yet challenging"25 * ],26 * "pricing": {27 * "subscription": {28 * "cycleDuration": {29 * "count": 1,30 * "unit": "YEAR"31 * },32 * "cycleCount": 033 * },34 * "price": {35 * "value": "50",36 * "currency": "USD"37 * }38 * },39 * "public": true,40 * "archived": false,41 * "primary": true,42 * "hasOrders": false,43 * "_createdDate": "2020-12-21T15:13:03.444Z",44 * "_updatedDate": "2020-12-31T11:51:16.859Z",45 * "slug": "ultimate",46 * "allowFutureStartDate": false,47 * "buyerCanCancel": true48 * }49 * }50 */