Last active
November 22, 2021 02:50
-
-
Save NickGreen/1ed87cee410bf342e7a40be410addff3 to your computer and use it in GitHub Desktop.
Add a new renewal period to WooCommerce Subscriptions to allow for custom renewal periods for products. Specifically a new "every 7th" selection that will set a subscription to renew every 7th renewal period..
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 | |
/** | |
* Plugin Name: WooCommerce Subscription Custom Renewal Period | |
* Description: Add a new renewal period to WooCommerce Subscriptions to allow for custom renewal periods for products. | |
* Author: Nick Green | |
* Version: 1.0 | |
* License: GPL v3 | |
*/ | |
function wcs_custom_renewal_period( $subscription_periods ) { | |
$subscription_periods[7] = sprintf( __( 'every %s', 'woocommerce-subscriptions' ), WC_Subscriptions::append_numeral_suffix( 7 ) ); | |
return $subscription_periods; | |
} | |
add_filter( 'woocommerce_subscription_period_interval_strings', 'wcs_custom_renewal_period' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you need to add more than one option, you can do it like so: