Skip to content

Instantly share code, notes, and snippets.

@woogist
Last active January 6, 2026 11:11
Show Gist options
  • Select an option

  • Save woogist/4cdda0868eec8750d7dbcea26a7c4fe6 to your computer and use it in GitHub Desktop.

Select an option

Save woogist/4cdda0868eec8750d7dbcea26a7c4fe6 to your computer and use it in GitHub Desktop.
[WooCommerce Subscriptions] Modify renewal intervals
/**
* 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