Created
January 11, 2021 09:55
-
-
Save ipokkel/8b75842bfa42e713702419224ba4a49d to your computer and use it in GitHub Desktop.
This recipe changes the order of some Add Ons on the checkout page by unhooking them and hooking them in at a different hook available on the checkout page. #pmpro #paid-memberships-pro #hooks #priority
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 | |
/** | |
* This recipe changes the order of Add Ons on the checkout page. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function load_pmpro_donations_after_pricing_fields() { | |
if ( has_action( 'pmpro_checkout_after_level_cost', 'pmprodon_pmpro_checkout_after_level_cost' ) ) { | |
remove_action( 'pmpro_checkout_after_level_cost', 'pmprodon_pmpro_checkout_after_level_cost' ); | |
add_action( 'pmpro_checkout_after_pricing_fields', 'pmprodon_pmpro_checkout_after_level_cost' ); | |
} | |
} | |
add_action( 'init', 'load_pmpro_donations_after_pricing_fields' ); | |
function load_pmpro_auto_renew_checkbox_after_level_cost() { | |
if ( has_action( 'pmpro_checkout_boxes', 'pmproarc_pmpro_checkout_boxes', 15 ) ) { | |
remove_action( 'pmpro_checkout_boxes', 'pmproarc_pmpro_checkout_boxes', 15 ); | |
add_action( 'pmpro_checkout_after_user_fields', 'pmproarc_pmpro_checkout_boxes', 15 ); | |
} | |
} | |
add_action( 'init', 'load_pmpro_auto_renew_checkbox_after_level_cost' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment