Created
November 12, 2019 09:52
-
-
Save bernattorras/a222a17de4c65102b13c66395c3ac4d4 to your computer and use it in GitHub Desktop.
Extend the subscription period intervals to a custom number
This file contains 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 | |
// Extend the subscription period intervals to a custom number | |
function eg_extend_subscription_period_intervals( $intervals ) { | |
$max_intervals = 30; // 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; | |
} | |
add_filter( 'woocommerce_subscription_period_interval_strings', 'eg_extend_subscription_period_intervals' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment