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_action( 'woocommerce_customer_changed_subscription_to_cancelled', 'customer_skip_pending_cancellation' ); | |
/** | |
* Change 'pending-cancel' status directly to 'cancelled'. | |
* | |
* @param WC_Subscription $subscription | |
*/ | |
function customer_skip_pending_cancellation( $subscription ) { | |
if ( 'pending-cancel' === $subscription->get_status() ) { |
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 customer email to Cancelled Order recipient list | |
*/ | |
function wc_cancelled_order_add_customer_email( $recipient, $order ){ | |
return $recipient . ',' . $order->billing_email; | |
} | |
add_filter( 'woocommerce_email_recipient_cancelled_order', 'wc_cancelled_order_add_customer_email', 10, 2 ); |
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 | |
function wcs_is_sub_active_notice() { | |
$sub_id = 445; | |
if ( wcs_get_subscription( $sub_id ) ) { | |
if ( wcs_get_subscription( $sub_id )->get_status() == 'active' ) { | |
$class = 'notice notice-error'; | |
$message = __( '445 is ACTIVE', 'sample-text-domain' ); |
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 | |
function add_customer_to_cancelled_subscription_email( $recipient, $order ) { | |
// Bail on WC settings pages since the order object isn't yet set yet | |
// Not sure why this is even a thing, but shikata ga nai | |
$page = $_GET['page'] = isset( $_GET['page'] ) ? $_GET['page'] : ''; | |
if ( 'wc-settings' === $page ) { | |
return $recipient; | |
} |
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 | |
function wc_increase_variation_threshold() { | |
return 500; | |
} | |
add_filter( 'woocommerce_ajax_variation_threshold', 'wc_increase_variation_threshold' ); |
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 | |
function wcs_custom_frequency( $intervals ) { | |
// change the $custom_frequency variable numerical value to what you'd like to add. | |
$custom_frequency = 50; | |
$intervals[$custom_frequency] = sprintf( __( 'every %s', 'my-text-domain' ), WC_Subscriptions::append_numeral_suffix( $custom_frequency ) ); | |
return $intervals; | |
} | |
add_filter( 'woocommerce_subscription_period_interval_strings', 'wcs_custom_frequency' ); |
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 | |
function wcs_redirect_to_cart( $url ) { | |
// If product is of the subscription type | |
if ( is_numeric( $_REQUEST['add-to-cart'] ) && WC_Subscriptions_Product::is_subscription( (int) $_REQUEST['add-to-cart'] ) ) { | |
// Redirect to cart instead | |
$url = WC()->cart->get_cart_url(); | |
} | |
return $url; | |
} |
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_subscriptions_update_users_role', '__return_false', 100 ); |
OlderNewer