Skip to content

Instantly share code, notes, and snippets.

@thenbrent
Last active May 14, 2024 21:04
Show Gist options
  • Save thenbrent/7237105 to your computer and use it in GitHub Desktop.
Save thenbrent/7237105 to your computer and use it in GitHub Desktop.
Add a new billing interval to WooCommerce Subscriptions. Specifically a "every 10 weeks" billing interval to selling a subscription to something and be charged every 10 weeks.
<?php
/**
* Plugin Name: Extend WooCommerce Subscription Intervals
* Description: Add a "every 10 weeks" billing interval to WooCommerce Subscriptions
* Author: Brent Shepherd
* Author URI: http://brent.io
* Version: 1.0
* License: GPL v2
*/
function eg_extend_subscription_period_intervals( $intervals ) {
$intervals[10] = sprintf( __( 'every %s', 'my-text-domain' ), WC_Subscriptions::append_numeral_suffix( 10 ) );
return $intervals;
}
add_filter( 'woocommerce_subscription_period_interval_strings', 'eg_extend_subscription_period_intervals' );
@7Rinzler
Copy link

Ok but now I have a problem.
My subscription is not renewed, it only works once because it is a one-time promotion and only for this time.

I can't set it to expire
Captura de Pantalla 2020-08-24 a la(s) 16 16 50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment