Last active
January 6, 2026 11:11
-
-
Save woogist/4cdda0868eec8750d7dbcea26a7c4fe6 to your computer and use it in GitHub Desktop.
[WooCommerce Subscriptions] Modify renewal intervals
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
| /** | |
| * Extend subscription period intervals to include a 364th option | |
| * | |
| * @param array $intervals Array of interval strings (e.g., [1 => 'every', 2 => 'every 2nd', ...]) | |
| * @return array Modified intervals array with 364 | |
| */ | |
| function wcs_custom_extend_period_intervals ( $intervals ) { | |
| // Keep the existing intervals (1-6) | |
| // Add interval 364 | |
| $intervals[ 364 ] = sprintf( | |
| _x( 'every %s', 'period interval with ordinal number (e.g. "every 2nd"', 'woocommerce-subscriptions' ), | |
| wcs_append_numeral_suffix( 364 ) | |
| ); | |
| // Sort by key to maintain order (1, 2, 3, 4, 5, 6, 364) | |
| ksort( $intervals ); | |
| return $intervals; | |
| } | |
| add_filter( 'woocommerce_subscription_period_interval_strings', 'wcs_custom_extend_period_intervals', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment