MemberPress: Change Non-Recurring Renewal Price

function mepr_change_product_renewal_price( $product_price, $coupon_code, $product ) { $user = new MeprUser( get_current_user_id() ); $subscriptions = $user->active_product_subscriptions( ‘ids’, true, true ); // change the 123 ID to the required one-time membership ID if ( $product->ID === 123 && in_array( $product->ID, $subscriptions…Continue reading

MemberPress: Bulk Delete All Expired Subscriptions

function mepr_delete_expired_txns() { $subscriptions = MeprSubscription::get_all(); if( is_array( $subscriptions ) && !empty( $subscriptions ) ) { foreach( $subscriptions as $subscription ) { $subscription = new MeprSubscription( $subscription->id ); if( $subscription->is_cancelled() && $subscription->is_expired() ) { $subscription->destroy(); } } } } add_action(…Continue reading

MemberPress: Expire Subscription Immediately After Subscription Is Canceled

function mepr_capture_stopped_sub( $event ) { global $wpdb; $subscription = $event->get_data(); $wpdb->update( $wpdb->prefix.’mepr_transactions’, array( “expires_at” => “2024-01-01 23:59:59” ), array( “subscription_id” => $subscription->id, “status” => “complete” ) ); } add_action( ‘mepr-event-subscription-stopped’, ‘mepr_capture_stopped_sub’ );Continue reading