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 Subscriptions - Allow Same Product Switch | |
* Plugin URI: | |
* Description: Allow switching to same product for WooCommerce Subscriptions | |
* Version: 1.0 | |
* Author: Nick Green | |
* Author URI: | |
**/ |
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 | |
// Extend the subscription period intervals to a custom number | |
function eg_extend_subscription_period_intervals( $intervals ) { | |
$max_intervals = 30; // The maximum number of intervals you want to display | |
$intervals = array( 1 => _x( 'every', 'period interval (eg "$10 _every_ 2 weeks")', 'woocommerce-subscriptions' ) ); | |
foreach ( range( 2, $max_intervals ) as $i ) { | |
$intervals[ $i ] = sprintf( _x( 'every %s', 'period interval with ordinal number (e.g. "every 2nd"', 'woocommerce-subscriptions' ), WC_Subscriptions::append_numeral_suffix( $i ) ); | |
} | |
return $intervals; | |
} |
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 | |
add_filter('woocommerce_subscription_period_interval_strings', 'add_extra_period_intervals', 10, 1); | |
function add_extra_period_intervals($intevals){ | |
$max_intervals = 10; // The maximum number of intervals you want to display | |
$intervals = array( 1 => _x( 'every', 'period interval (eg "$10 _every_ 2 weeks")', 'woocommerce-subscriptions' ) ); | |
foreach ( range( 2, $max_intervals ) as $i ) { | |
$intervals[ $i ] = sprintf( _x( 'every %s', 'period interval with ordinal number (e.g. "every 2nd"', 'woocommerce-subscriptions' ), WC_Subscriptions::append_numeral_suffix( $i ) ); | |
} |
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 | |
add_filter('automatewoo/referrals/coupon_data', 'my_automatewoo_referrals_coupon_data' ); | |
/** | |
* Restrict referral coupon to product IDs | |
* | |
* @param array $coupon_data | |
* @return array | |
*/ |