Skip to content

Instantly share code, notes, and snippets.

@woogist
Created February 2, 2026 08:14
Show Gist options
  • Select an option

  • Save woogist/3e4aa2e8e2c12166ab673d9993d5ca13 to your computer and use it in GitHub Desktop.

Select an option

Save woogist/3e4aa2e8e2c12166ab673d9993d5ca13 to your computer and use it in GitHub Desktop.
[WooCommerce Memberships] Removes membership access for processing orders
<?php // only copy this line if needed
/**
* Removes membership access for processing orders
* so access is only granted at when orders are complete
*/
function sv_wc_memberships_remove_processing_access() {
// make sure Memberships is active first
if ( function_exists( 'wc_memberships' ) ) {
remove_action( 'woocommerce_order_status_processing', array( wc_memberships()->get_plans_instance(), 'grant_access_to_membership_from_order' ), 9 );
}
// Add support for Teams for Memberships but make sure it is active first
if ( function_exists( 'wc_memberships_for_teams' ) ) {
remove_action( 'woocommerce_order_status_processing', array( wc_memberships_for_teams()->get_orders_instance(), 'process_team_actions_for_order' ), 10 );
}
}
add_action( 'init', 'sv_wc_memberships_remove_processing_access' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment