LLMS_Order::get_remaining_payments()
Retrieves the number of payments remaining for a recurring plan with a limited number of payments
Return Return
(bool|int) Returns false
for invalid order types (single-payment orders or recurring orders without a billing length). Otherwise returns the number of remaining payments as an integer.
Source Source
File: includes/models/model.llms.order.php
* without a billing length). Otherwise returns the number of remaining payments as an integer. */ public function get_remaining_payments() { $remaining = false; if ( $this->has_plan_expiration() ) { $len = $this->get( 'billing_length' ); $txns = $this->get_transactions( array( 'status' => array( 'llms-txn-succeeded', 'llms-txn-refunded' ), 'per_page' => 1, 'type' => array( 'recurring', 'single' ), // If a manual payment is recorded it's counted a single payment and that should count. ) ); $remaining = $len - $txns['total']; } /** * Filters the number of payments remaining for a recurring plan with a limited number of payments. * * @since 5.3.0 * * @param bool|int $remaining Number of remaining payments or `false` when called against invalid order types. * @param LLMS_Order $order Order object. */ return apply_filters( 'llms_order_remaining_payments', $remaining, $this );
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.3.0 | Introduced. |