lifterlms_template_pricing_table( int $post_id = null )

Include pricing table for a LifterLMS Product (course or membership)


Description Description


Parameters Parameters

$post_id

(int) (Optional) WP Post ID of the product. Default is ID of the global $post.

Default value: null


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/functions/llms.functions.templates.pricing.table.php

	function lifterlms_template_pricing_table( $post_id = null ) {

		$post_id = $post_id ? $post_id : get_the_ID();
		$product = new LLMS_Product( $post_id );

		/**
		 * Filter current user's enrollment status
		 *
		 * This filter is used to customize the output behavior of the pricing table.
		 * It does not modify the user's enrollment status.
		 *
		 * @since Unknown
		 *
		 * @param boolean $is_enrolled User's current enrollment status.
		 */
		$is_enrolled = apply_filters(
			'llms_product_pricing_table_enrollment_status',
			llms_is_user_enrolled( get_current_user_id(), $product->get( 'id' ) )
		);

		$purchasable      = $product->is_purchasable();
		$has_free         = $product->has_free_access_plan();
		$has_restrictions = $product->has_restrictions();

		/**
		 * Fix variable spelling in a backwards compatible way
		 *
		 * If the template "product/pricing-table.php" is overwritten and relies
		 * on the misspelled variable, passing both versions in will ensure the
		 * template continues to function as expected.
		 *
		 * @link https://github.com/gocodebox/lifterlms/issues/1128
		 *
		 * @deprecated 3.38.0
		 */
		$purchaseable = $purchasable;

		llms_get_template(
			'product/pricing-table.php',
			compact( 'product', 'is_enrolled', 'purchasable', 'purchaseable', 'has_free', 'has_restrictions' )
		);

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.38.0 Fixed spelling error in variable passed to template.
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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