LLMS_Order::get_next_payment_due_date( string $format = 'Y-m-d H:i:s' )

Retrieve the due date of the next payment according to access plan terms


Description Description


Parameters Parameters

$format

(string) (Optional) date format to return the date in (see php date())

Default value: 'Y-m-d H:i:s'


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/models/model.llms.order.php

	public function get_next_payment_due_date( $format = 'Y-m-d H:i:s' ) {

		// single payments will never have a next payment date
		if ( ! $this->is_recurring() ) {
			return new WP_Error( 'not-recurring', __( 'Order is not recurring', 'lifterlms' ) );
		} elseif ( ! in_array( $this->get( 'status' ), array( 'llms-active', 'llms-failed', 'llms-on-hold', 'llms-pending', 'llms-pending-cancel' ) ) ) {
			return new WP_Error( 'invalid-status', __( 'Invalid order status', 'lifterlms' ), $this->get( 'status' ) );
		}

		// retrieve the saved due date
		$next_payment_date = $this->get_date( 'date_next_payment', 'U' );

		// calculate it if not saved
		if ( ! $next_payment_date ) {
			$next_payment_date = $this->calculate_next_payment_date( 'U' );
			if ( ! $next_payment_date ) {
				return new WP_Error( 'plan-ended', __( 'No more payments due', 'lifterlms' ) );
			}
		}

		return date_i18n( $format, apply_filters( 'llms_order_get_next_payment_due_date', $next_payment_date, $this, $format ) );

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: