LLMS_Transaction::can_be_refunded()

Determines if the transaction can be refunded.


Description Description

Status must not be "failed" and total refunded amount must be less than order amount.


Top ↑

Return Return

(boolean)


Top ↑

Source Source

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

	public function can_be_refunded() {

		$can_be_refunded = true;

		if ( in_array( $this->get( 'status' ), array( 'llms-txn-failed', 'llms-txn-pending' ), true ) ) {
			$can_be_refunded = false;
		} elseif ( $this->get_refundable_amount( array(), 'float' ) <= 0 ) {
			$can_be_refunded = false;
		}

		/**
		 * Filters whether or not a transaction can be refunded.
		 *
		 * @since 7.0.0
		 *
		 * @param boolean          $can_be_refunded Whether the transaction can be refunded.
		 * @param LLMS_Transaction $transaction     The transaction object.
		 */
		return apply_filters( 'llms_transaction_can_be_refunded', $can_be_refunded, $this );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Made the return value filterable via the llms_transaction_can_be_refunded hook.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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