Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Load the PMPro Stripe Library Earlier
/**
* Load the PMPro Stripe Library Earlier
* Works with PMPro v2.1+
* Use this if you are experiencing errors like Stripe/PaymentMethod not found
* or other errors that might be caused by another Stripe Library loading earlier.
*
* This is not meant as a final solution.
* With this coded enabled, you may notice other Stripe-related plugins breaking.
* When you find the other plugin that is affecting things, you can see if
* that plugin is needed or if there is an update.
* Or you can use more specific code to make sure that that plugin doesn't load
* their older version of the Stripe API on the PMPro checkout and update billing pages.
*/
function my_load_pmpro_stripe_library_early() {
if ( defined( 'PMPRO_DIR' ) && function_exists( 'pmpro_is_checkout' ) && pmpro_is_checkout() ) {
require_once( PMPRO_DIR . "/includes/lib/Stripe/init.php" );
}
}
add_action( 'init', 'my_load_pmpro_stripe_library_early', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment