LLMS_Access_Plan::get_price( string $key, array $price_args = array(), string $format = 'html', LLMS_Coupon|int|null $coupon = null )

Getter for price strings with optional formatting options


Parameters Parameters

$key

(string) (Required) Property key.

$price_args

(array) (Optional) array of arguments that can be passed to llms_price().

Default value: array()

$format

(string) (Optional) format conversion method [html|raw|float].

Default value: 'html'

$coupon

(LLMS_Coupon|int|null) (Optional) Coupon ID, object, or null if no coupon is being used.

Default value: null


Top ↑

Return Return

(mixed)


Top ↑

Source Source

File: includes/models/model.llms.access.plan.php

		if ( $coupon ) {
			return $this->get_price_with_coupon( $key, $coupon, $price_args, $format );
		}

		$price = $this->get( $key );

		if ( $price <= 0 ) {

			$ret = $this->get_free_pricing_text( $format );

		} else {

			$ret = parent::get_price( $key, $price_args, $format );

		}

		/**
		 * Filter the access plan's price.
		 *
		 * @since 3.40.0
		 *
		 * @param mixed            $ret        Returned price.
		 * @param string           $key        The key of the price property.
		 * @param array            $price_args Price arguments.
		 * @param string           $format     Price format string.
		 * @param LLMS_Access_Plan $this       Instance of the access plan.
		 */
		return apply_filters( 'llms_plan_get_price', $ret, $key, $price_args, $format, $this );
	}



Top ↑

Changelog Changelog

Changelog
Version Description
3.40.0 Added $coupon parameter.
3.23.0 Unknown.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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