llms_insert_access_plan( array $props = array() )

Create or update an access plan.


Description Description

If $props has an "ID" parameter, that plan will be updated, otherwise a new plan will be created.

See also See also


Top ↑

Parameters Parameters

$props

(Optional) An array of of properties that make up the plan to create or update.

  • 'product_id'
    (int) Required) WP Post ID of the related LifterLMS Product (course or membership).
  • 'id'
    (int) WP Post ID of the Access Plan, if omitted a new plan is created, if supplied, that plan is updated.
  • 'access_expiration'
    (string) Expiration type [lifetime|limited-period|limited-date].
  • 'access_expires'
    (string) Date access expires in m/d/Y format. Only applicable when $access_expiration is "limited-date".
  • 'access_length'
    (int) Length of access from time of purchase, combine with $access_period. Only applicable when $access_expiration is "limited-period".
  • 'access_period'
    (string) Time period of access from time of purchase, combine with $access_length. Only applicable when $access_expiration is "limited-period" [year|month|week|day].
  • 'availability'
    (string) Determine if this access plan is available to anyone or to members only. Use with $availability_restrictions to determine if the member can use the access plan. [open|members].
  • 'availability_restrictions'
    (array) Indexed array of LifterLMS Membership IDs a user must belong to to use the access plan. Only applicable if $availability is "members".
  • 'checkout_redirect_type'
    (string) Type of checkout redirection [self|page|url].
  • 'content'
    (string) Plan description (post_content).
  • 'enroll_text'
    (string) Text to display on buy buttons.
  • 'frequency'
    (int) Frequency of billing. 0 = a one-time payment [0-6].
  • 'is_free'
    (string) Whether or not the plan requires payment [yes|no].
  • 'length'
    (int) Number of intervals to run payment for, combine with $period & $frequency. 0 = forever / until cancelled. Only applicable if $frequency is not 0.
  • 'menu_order'
    (int) Order to display access plans in when listing them. Displayed in ascending order.
  • 'on_sale'
    (string) Enable or disable plan sale pricing [yes|no].
  • 'period'
    (string) Interval period, combine with $length. Only applicable if $frequency is not 0. [year|month|week|day].
  • 'price'
    (float) Price per charge/
  • 'sale_end'
    (string) Date when the sale pricing ends.
  • 'sale_start'
    (string) Date when the sale pricing begins.
  • 'sale_price'
    (float) Sale price.
  • 'sku'
    (string) Short user-created plan identifier.
  • 'title'
    (string) Plan title.
  • 'trial_length'
    (int) length of the trial period. Only applicable if $trial_offer is "yes".
  • 'trial_offer'
    (string) Enable or disable a plan trial period. [yes|no].
  • 'trial_period'
    (string) Period for the trial period. Only applicable if $trial_offer is "yes". [year|month|week|day].
  • 'trial_price'
    (float) Price for the trial period. Can be 0 for a free trial period.

Default value: array()


Top ↑

Return Return

(LLMS_Access_Plan|WP_Error) LLMS_Access_Plan on success, WP_Error on failure.


Top ↑

Source Source

File: includes/functions/llms-functions-access-plans.php


			

Top ↑

Changelog Changelog

Changelog
Version Description
3.30.3 Fixed spelling errors.
3.30.0 Added checkout redirect options.
3.29.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.