Created
December 12, 2018 17:22
-
-
Save ideadude/72bcacd88f17b0a6fc7ddbd6609fdfab to your computer and use it in GitHub Desktop.
Keep pmpro_next_payment_date() from using the Stripe API.
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
/** | |
* Keep pmpro_next_payment_date() from using the Stripe API. | |
* Instead, the next payment date will be calculated based on | |
* the date of the last order in PMPro. | |
* This will be inaccurate in some cases with regards to trials, | |
* but avoids issues where Stripe is giving the wrong "next payment" | |
* date when payments fail. | |
*/ | |
function my_disable_stripe_api_next_payment_date( $next_payment_date ) { | |
// remove this filter which may run later | |
remove_filter('pmpro_next_payment', array('PMProGateway_stripe', 'pmpro_next_payment'), 10, 3); | |
// return the default payment date calculated | |
return $next_payment_date; | |
} | |
add_action( 'pmpro_next_payment', 'my_disable_stripe_api_next_payment_date', 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment