The Subscriptions plugin already gives you the ability to create a day-long subscription, a month-long subscription, and subscriptions that can renew every other week. While it has a lot of intervals, it can't possibly have every one. If you want to have a subscription that renews every tenth week, you'll have to create a custom subscription interval. Using filters in Subscriptions, we can easily add this.
You must have the WooCommerce Subscriptions plugin installed and activated on your site. You should also have a subscription product already created.
In order to create a custom subscription interval, go through the following steps:
functions.php
file, located under wp-content/themes/your-theme-name/
, or create a custom WooCommerce plugin and open up that file.add_filter( 'woocommerce_subscription_period_interval_strings', 'woocommerce_cookbook_subscription_intervals' );
function woocommerce_cookbook_subscription_intervals( $intervals ) { $intervals[10] = sprintf( __( 'every %s', 'woocommerce-cookbook' ),WC_Subscriptions::append_numeral_suffix( 10 ) ); return $intervals; }
Now that we've created our custom interval, we need to edit our subscription product to use that interval.