Created
November 29, 2018 12:54
-
-
Save bernattorras/26b2a7e22ad0b772e36f718431a6a781 to your computer and use it in GitHub Desktop.
Add extra intervals to the subscription periods (WCS and WCSATT)
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 | |
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