setPlanVisibility( )
Sets visibility for non-archived pricing plans. Public plans are plans that are set to visible.
Description
The setPlanVisibility()
function returns a Promise that resolves to a pricing plan when its
visibility has successfully been set.
By default, pricing plans are public, meaning they are visible. Plans can be hidden so that site members and visitors cannot see or choose them.
As opposed to archiving, setting visibility can be reversed. This means that a public plan can be hidden, and a hidden plan can be made public (visible).
Note: An archived plan always remains archived and cannot be made active again. When archiving a plan, its
visibility
property is automatically set tofalse
so that it is hidden.
Changing a plan’s visibility does not impact existing orders for the plan. All orders for hidden plans are still active and keep their terms and payment options.
Only users with "Manage Pricing Plans" permissions can change plan visibility.
Authorization
Request
This endpoint does not take any parameters
Response Object
Fulfilled - The plan's information. Rejected - Error message.
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.
Status/Error Codes
Was this helpful?
Hide a plan
1import wixPricingPlansBackend from 'wix-pricing-plans-backend';23export function mySetPlanVisibilityFunction() {4 const planId = '3743d382-a4d4-7e15-ada5-340ad4b5d760';5 const visibilityToggle = false;6 return wixPricingPlansBackend.setPlanVisibility(planId, visibilityToggle)7 .then(() => {8 console.log("Plan hidden"); // Plan is visible in the Dashboard9 })10 .catch((error) => {11 console.error(error);12 });13 }1415/* Full event object:16 * {17 * "metadata": {18 * "id": "3743d382-a4d4-7e15-ada5-340ad4b5d760",19 * "entityId": "c61bbc26-a4d4-7e15-ada5-f99803abce33",20 * "eventTime": "2020-02-03T10:13:15.194Z",21 * "triggeredByAnonymizeRequest": false22 * },23 * "entity": {24 * "_id": "c61bbc26-a4d4-7e15-ada5-f99803abce33",25 * "name": "Full membership",26 * "description":"Full membership including weekends",27 * "perks": [28 * "Free parking",29 * "Express line"30 * ],31 * "pricing": {32 * "singlePaymentUnlimited": true,33 * "price": {34 * "value": "40",35 * "currency": "USD"36 * }37 * },38 * "public" : true,39 * "_createdDate": "2020-02-03T10:13:15.194Z",40 * "_updatedDate": "2020-02-03T10:13:15.194Z",41 * "slug":"full-membership",42 * "maxPurchasesPerBuyer": 1,43 * "allowFutureStartDate": false,44 * "buyerCanCancel": true,45 * "termsAndConditions": "Copyright laws apply."46 * }47 * }48 */