Evolution request : Add a filter on the method
-
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.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Evolution request : Add a filter on the method’ is closed to new replies.