Skip to content

Instantly share code, notes, and snippets.

@bernattorras
Created November 29, 2018 12:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bernattorras/26b2a7e22ad0b772e36f718431a6a781 to your computer and use it in GitHub Desktop.
Save bernattorras/26b2a7e22ad0b772e36f718431a6a781 to your computer and use it in GitHub Desktop.
Add extra intervals to the subscription periods (WCS and WCSATT)
<?php
add_filter('woocommerce_subscription_period_interval_strings', 'add_extra_period_intervals', 10, 1);
function add_extra_period_intervals($intevals){
$max_intervals = 10; // The maximum number of intervals you want to display
$intervals = array( 1 => _x( 'every', 'period interval (eg "$10 _every_ 2 weeks")', 'woocommerce-subscriptions' ) );
foreach ( range( 2, $max_intervals ) as $i ) {
$intervals[ $i ] = sprintf( _x( 'every %s', 'period interval with ordinal number (e.g. "every 2nd"', 'woocommerce-subscriptions' ), WC_Subscriptions::append_numeral_suffix( $i ) );
}
return $intervals;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment