How To Add Custom Billing Intervals To WooCommerce Subscriptions

By James LePage
 on April 20, 2021
Last modified on January 6th, 2022

How To Add Custom Billing Intervals To WooCommerce Subscriptions

By James LePage
 on April 20, 2021
Last modified on January 6th, 2022

Do you want to have more control over the billing intervals on your WooCommerce subscriptions? Setting custom billing intervals is easy and can help give your customers flexibility. In this article, we will take a look at how to add custom billing intervals to WooCommerce subscriptions. We will also take a look at some of the best practices you should follow when setting up these new settings so that everything works smoothly for both you and your customer.

WooCommerce subscriptions allow you to create a recurring payment for your customers. Depending on the subscription, this can be daily, monthly or yearly. The default billing interval is one month (or 30 days) but you have the option of changing it if need be. However, you're limited to every XX day/week/month, instead of being able to input whatever interval you want.

In order to add custom billing intervals, you need a WooCommerce Subscriptions plugin. This will change how the subscription works and allow you to set any interval you want- on whatever schedule is most convenient for your customer.

Now, to add the custom intervals, all you need to do is add the following code:

function eg_extend_subscription_period_intervals( $intervals ) { $intervals[8] = sprintf( __( 'every %s', 'my-text-domain' ), WC_Subscriptions::append_numeral_suffix( 8 ) ); $intervals[12] = sprintf( __( 'every %s', 'my-text-domain' ), WC_Subscriptions::append_numeral_suffix( 12 ) ); $intervals[24] = sprintf( __( 'every %s', 'my-text-domain' ), WC_Subscriptions::append_numeral_suffix( 24 ) ); return $intervals; } add_filter( 'woocommerce_subscription_period_interval_strings', 'eg_extend_subscription_period_intervals' );
Code language: PHP (php)


This will add three additional items to the WooCommerce Subscriptions interval dropdown, every 8 days, every 12 days and every 24 days. To add additional intervals, just add another of this line:

$intervals[24] = sprintf( __( 'every %s', 'my-text-domain' ), WC_Subscriptions::append_numeral_suffix( 24 ) );
Code language: PHP (php)

Change the 24 to whatever number of days you want the given subscription to renew on.

Now, you'll have custom intervals added to your WooCommerce subscriptions backend.

Meet CodeWP, an AI Code Generator
Prompt CodeWP in plain English and it'll output high quality code, specific for WordPress.
Join The IsoGroup
A vibrant Facebook Group to talk about web design and the business of agency. Daily curated resources and conversations.
Join Now
Bricks Builder Course - Coming Soon
The Bricks Builder Mastery course will bring you up to speed on this popular builder.
Get Launch Notification & Discount
Subscribe & Share
If you liked this content, subscribe for our monthly roundup of WordPress news, website inspiration, exclusive deals and interesting articles.
Unsubscribe at any time. We do not spam and will never sell or share your email.
Notify of
Newest Most Voted
Inline Feedbacks
View all comments
1 year ago

Hello! How can I give the client the option to enter a custom interval?

Article By
James LePage
James LePage is the founder of Isotropic Design, a digital agency that builds WordPress websites. I read, write and design constantly!
We're looking for new authors. Explore Isotropic Jobs.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram