Created
May 19, 2023 04:56
-
-
Save andrewlimaza/938056a3997c38075d3e858d3ada528b to your computer and use it in GitHub Desktop.
Add compatibility for PMPro Set Expiration Date Add On and PMPro WooCommerce Add On.
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 | |
/** | |
* Support Set Expiration Date Add On for PMPro WooCommerce Add On. | |
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmprowoo_set_expiration_date( $level_array ) { | |
// Make sure Set Expiration Date Add On is active. | |
if ( ! function_exists( 'pmpro_getSetExpirationDate' ) ) { | |
return $level_array; | |
} | |
// Does this level have a set expiration date? | |
$set_expiration_date = pmpro_getSetExpirationDate( $level_array['membership_id'] ); | |
if ( ! empty( $set_expiration_date ) ) { | |
$level_array['enddate'] = pmprosed_fixDate( $set_expiration_date ); | |
} | |
return $level_array; | |
} | |
add_filter( 'pmprowoo_checkout_level', 'my_pmprowoo_set_expiration_date', 20 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment