• Resolved valousal

    (@valentinanamorphik)


    Hi,

    Why is a subscription with “CANCELLED” status considered an active subscription?

        public function get_active_subscriptions($include_trial = true)
        {
            $statuses = [
                SubscriptionStatus::ACTIVE,
                SubscriptionStatus::COMPLETED,
                SubscriptionStatus::CANCELLED
            ];
    
            if ($include_trial) $statuses[] = SubscriptionStatus::TRIALLING;
    
            $subs = $this->get_subscriptions($statuses);
    
            $result = [];
    
            if ( ! empty($subs)) {
    
                foreach ($subs as $sub) {
                    if ($sub->is_active() && ! $sub->is_expired()) $result[] = $sub;
                }
            }
    
            return $result;
        }

    Is it possible to add a filter on the “get_active_subscriptions” ?

    apply_filters('ppress_status_active_subscriptions', $statuses);

    Thanks.

Viewing 1 replies (of 1 total)
  • Plugin Author Collins Agbonghama

    (@collizo4sky)

    Say a user subscribe to a yearly membership plan. After purchase, they decided they dont want the subscription to auto-renew, they can cancel their subscription but that doesn’t mean the subscription is not active. The subscription becomes inactive after it expires.

    We’ve added the following filter that will be in the next plugin update

    apply_filters('ppress_customer_active_subscriptions', $result, $this);
Viewing 1 replies (of 1 total)
  • The topic ‘Status active subscriptions’ is closed to new replies.