Alter Subscription Expiry Date Range Using Subscriptions for WooCommerce
Using the following code snippet you can expand the monthly range of the subscription length after which the subscription expires with Subscriptions for WooCommerce. Currently, the plugin helps you to set the subscription length up to 24 months for month based subscriptions.
Add the code snippet below to the active child theme’s function.php file. Add the required length for the subscription by adding to the code and changing the range label and the second index of the subscription_ranges array.
The code snippet can also be used to alter the number of days, the number of weeks, and the number of year in the subscription length. Currently, the plugin supports up to 90 days for daily subscriptions, up to 52 weeks for week based subscriptions, and up to 5 years for year based subscriptions.
To extend the subscription length for days, weeks, or years, you need to change the first and second indexes of the subscription range array and the range label. For example, you can have the length of a daily subscription up to 90 days. To extend the number of days in the subscription length up to say 95, you need to change the code within the wt_add_length() function as:
$subscription_ranges['day'] = __('91 days', 'xa-woocommerce-subscriptions');
up to the required length. Similarly for weeks and years.