Last active
April 2, 2021 10:25
-
-
Save thenbrent/d1e10ab5e7fffda5b4d2 to your computer and use it in GitHub Desktop.
Add a new billing interval to WooCommerce Subscriptions to allow for longer intervals between subscription renewal payments. Specifically a new "8" interval to allow you to sell a subscription that renews every 8 days, weeks, months or years.
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 Interval | |
* Description: Add a custom 8 week subscription interval to WooCommerce Subscriptions | |
* Author: Brent Shepherd | |
* Version: 1.0 | |
* License: GPL v2 | |
*/ | |
function eg_add_custom_subscription_interval( $subscription_intervals ) { | |
$subscription_intervals['8'] = sprintf( __( 'every %s', 'woocommerce-subscriptions' ), WC_Subscriptions::append_numeral_suffix( 8 ) ); | |
return $subscription_intervals; | |
} | |
add_filter( 'woocommerce_subscription_period_interval_strings', 'eg_add_custom_subscription_interval' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jethromay I just copied it directly from above into my theme's functions.php file and it worked for me:
Image Link: https://d.pr/i/LjuZdZ