LLMS_Order::can_be_retried()

Determine if the order can be retried for recurring payments


Return Return

(boolean)


Top ↑

Source Source

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

	public function can_be_retried() {

		$can_retry = true;

		if (
			// Only recurring orders can be retried.
			! $this->is_recurring() ||
			// Recurring rety feature is disabled.
			! llms_parse_bool( get_option( 'lifterlms_recurring_payment_retry', 'yes' ) ) ||
			// Only active & on-hold orders qualify for a retry.
			! in_array( $this->get( 'status' ), array( 'llms-active', 'llms-on-hold' ), true )
		) {
			$can_retry = false;
		} else {

			// If the gateway isn't active or the gateway doesn't support recurring retries.
			$gateway = $this->get_gateway();
			if ( is_wp_error( $gateway ) || ! $gateway->supports( 'recurring_retry' ) ) {
				$can_retry = false;
			}
		}

		/**
		 * Filters whether or not a recurring order can be retried
		 *
		 * @since 5.2.1
		 *
		 * @param boolean    $can_retry Whether or not the order can be retried.
		 * @param LLMS_Order $order     Order object.
		 */
		return apply_filters( 'llms_order_can_be_retried', $can_retry, $this );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.2.1 Combine conditions that return false.
5.2.0 Use strict type comparison.
3.10.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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