Evolution request : Add a filter on the method

[ad_1]

Hi,

Evolution request.

Is it possible to add a filter on the “get_plan_expiration_datetime” method of the “SubscriptionService” class?

We need to return a different expiration date.

<?php

public function get_plan_expiration_datetime($plan_id)
    {
        $plan = ppress_get_plan($plan_id);

        if ( ! $plan->is_recurring()) return '';

        $carbon = CarbonImmutable::now(wp_timezone());

        if ($plan->has_free_trial()) {

            $duration = explode('_', $plan->get_free_trial());
            $period   = $carbon->add($duration[0], $duration[1]);

        } else {

            $period = $plan->billing_frequency;

            switch ($period) {
                case SubscriptionBillingFrequency::DAILY :
                    $period = $carbon->addDay();
                    break;
                case SubscriptionBillingFrequency::WEEKLY :
                    $period = $carbon->addWeek();
                    break;
                case SubscriptionBillingFrequency::QUARTERLY :
                    $period = $carbon->addMonths(3);
                    break;
                case SubscriptionBillingFrequency::EVERY_6_MONTHS :
                    $period = $carbon->addMonths(6);
                    break;
                case SubscriptionBillingFrequency::YEARLY :
                    $period = $carbon->addYear();
                    break;
                default:
                    $period = $carbon->addMonth();
                    break;
            }
        }

        // return $period->toDateTimeString();
        return apply_filters('ppress_plan_expiration_datetime', $period->toDateTimeString());

    }

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