Last active
August 29, 2015 14:09
-
-
Save WillBrubaker/f01bc7ea4e492c6f04c5 to your computer and use it in GitHub Desktop.
Adds custom durations to woocommerce-subscriptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //* Do NOT include the opening php tag | |
| add_filter( 'woocommerce_subscription_lengths', 'wooninja_custom_subscription_duration' ); | |
| /** | |
| * Filters the subscription lengths available | |
| * @param array $ranges the array of ranges (lengths) | |
| * @return array $ranges the filtered array of ranges (lengths) | |
| */ | |
| function wooninja_custom_subscription_duration( $ranges ) { | |
| //add a range of 180 days | |
| $ranges['day'][180] = '180 days'; | |
| //add a range of 104 weeks | |
| $ranges['week'][104] = '104 weeks'; | |
| //add a range of 36 months | |
| $ranges['month'][36] = '36 months'; | |
| //add a range of 6 years | |
| $ranges['year'][6] = '6 years'; | |
| return $ranges; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment