Skip to content

Instantly share code, notes, and snippets.

View jrick1229's full-sized avatar
☠️

Joey Ricketts jrick1229

☠️
  • VA
  • 17:13 (UTC -04:00)
View GitHub Profile
@NickGreen
NickGreen / allow_same_product_switch.php
Last active December 28, 2019 11:01
Allow switching to identical product
<?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:
**/
@bernattorras
bernattorras / extend_sub_intervals.php
Created November 12, 2019 09:52
Extend the subscription period intervals to a custom number
<?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;
}
@bernattorras
bernattorras / add_extra_period_intervals.php
Created November 29, 2018 12:54
Add extra intervals to the subscription periods (WCS and WCSATT)
<?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 ) );
}
@danielbitzer
danielbitzer / functions.php
Last active September 14, 2022 11:29
Restrict referral coupons by product ID
<?php
add_filter('automatewoo/referrals/coupon_data', 'my_automatewoo_referrals_coupon_data' );
/**
* Restrict referral coupon to product IDs
*
* @param array $coupon_data
* @return array
*/