Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrewlimaza/938056a3997c38075d3e858d3ada528b to your computer and use it in GitHub Desktop.
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.
<?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