This file contains hidden or 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 | |
$order = wc_get_order( $order_id ); | |
$sub_in_order = false; | |
$items = $order->get_items(); | |
foreach ( $items as $item ) { | |
This file contains hidden or 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 remove_basic_membership( $plan, $args ) { | |
// Check that we're purchasing anything other than the basic plan (change number to basic plan id) | |
if ( 123 !== $plan->id ) { | |
$memberships = wc_memberships_get_user_memberships( $args['user_id'] ); | |
foreach ( $memberships as $membership ) { | |
// Check to see if this member has the basic plan | |
// then delete it if so |
This file contains hidden or 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( 'wcsg_is_giftable_product', 'disable_gifting_by_product', 12, 2 ); | |
function disable_gifting_by_product( $is_sub, $product ) { | |
$not_giftable_products = array( 906, 964 ); // add or remove product IDs here | |
if ( in_array( $product->get_id(), $not_giftable_products ) ) { | |
return false; | |
} else { | |
return $is_sub; | |
} | |
} |
This file contains hidden or 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( 'wp_head', 'opc_disable_messages' ); | |
function opc_disable_messages(){ | |
remove_action( 'wcopc_product_selection_fields_before', array( 'PP_One_Page_Checkout', 'opc_messages' )); | |
} |
This file contains hidden or 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_email_recipient_expired_subscription', 'wcs_change_recipient_for_expired_sub_notification', 10, 2 ); | |
function wcs_change_recipient_for_expired_sub_notification( $recipient, $order ) { | |
$page = $_GET['page'] = isset( $_GET['page'] ) ? $_GET['page'] : ''; | |
if ( 'wc-settings' === $page ) { | |
return $recipient; | |
} | |
$recipient = $order->billing_email; | |
return $recipient; |
This file contains hidden or 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('wcs_get_users_subscriptions','sort_subscriptions', 10, 2); | |
function sort_subscriptions( $subscriptions, $user_id ){ | |
// choose either ksort or krsort | |
// in ascending order by ID | |
// ksort($subscriptions); | |
// in descending order by ID |
This file contains hidden or 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 allow_synced_product_early_renewal( false, $subscription ) { | |
return true; | |
} | |
add_filter( 'wcs_allow_synced_product_early_renewal', 'allow_synced_product_early_renewal' ); |
This file contains hidden or 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 - Remove Recurring Totals | |
Plugin URI: | |
Description: Don't display the recurring totals in cart or checkout | |
Version: 1.0 | |
Author: Support | |
Author URI: | |
*/ |
This file contains hidden or 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_subscription_status_updated', 'test_func', 100, 3); | |
function test_func($subscription, $new_status, $old_status) { | |
if( 'pending-cancel' == $new_status ) { | |
error_log( 'In ' . __FUNCTION__ . '(), status changed to = ' . var_export( $new_status, true ) ); | |
} | |
} |