Last active
March 18, 2025 13:11
-
-
Save kimwhite/eab8b23415ec41a41a3cd16e0bb4549c to your computer and use it in GitHub Desktop.
This recipe Adjusts the priority of the Group Account hook on the pmpro_checkout_level filter.
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 // do not copy this line | |
/** | |
* Adjust Group Account Hook Priority for Compatibility with Auto-Renewal Checkbox Add On | |
* | |
* This recipe modifies the priority of the Group Account hook on the `pmpro_checkout_level` filter. | |
* Resolves a conflict when using the Auto-Renewal Checkbox Add On with a Group Leader Account | |
* to ensure proper functionality at checkout. | |
* | |
* For use when using both: | |
* - Group Accounts Add On: https://www.paidmembershipspro.com/add-ons/group-accounts/ | |
* - Auto-Renewal Checkbox Add On: https://www.paidmembershipspro.com/add-ons/auto-renewal-checkbox-membership-checkout/ | |
* | |
* Add this customization to your site by creating a custom plugin or using the | |
* Code Snippets plugin available for free in the WordPress repository. | |
* Step-by-step guide: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* | |
* Keywords: Group Accounts, Auto-Renewal, Membership Checkout, Priority Hook, Fix Conflict, | |
* pmpro_checkout_level, Add On Compatibility | |
* | |
* @return void | |
*/ | |
function modify_pmprogroupacct_hook() { | |
if (function_exists('pmprogroupacct_pmpro_checkout_level_parent')) { | |
// Remove the existing hook to adjust its priority | |
remove_filter('pmpro_checkout_level', 'pmprogroupacct_pmpro_checkout_level_parent', 10); | |
// Re-add the hook with a higher priority (executed earlier) | |
add_filter('pmpro_checkout_level', 'pmprogroupacct_pmpro_checkout_level_parent', 6); | |
} | |
} | |
add_action('init', 'modify_pmprogroupacct_hook'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment