Status active subscriptions | WordPress.org

[ad_1]

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.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer