Archives: Snippets
MemberPress: Change Country VAT Rate for a Certain Membership
function mepr_cust_tax_rate( $tax_rate, $country, $prd_id ) { // If Membership ID 14 and country is Germany ‘DE’ if ( $prd_id === 123 && $country === ‘DE’ ) { $tax_rate->tax_rate = 0; // Set tax rate to 0 } return $tax_rate;…Continue reading
MemberPress: Change Courses Listing Page Link
add_filter( ‘post_type_archive_link’, function ( $link, $post_type ) { if ( $post_type == ‘mpcs-course’ ) { $link = home_url() . ‘/courses/’; //replace the word courses with the custom page or post slug } return $link; }, 10, 2 );Continue reading
MemberPress: Enable Phone Number Collection on Stripe Checkout
add_filter(‘mepr_stripe_checkout_session_args’, function($args) { $args[‘phone_number_collection’] = [ ‘enabled’ => ‘true’ ]; return $args; });Continue reading
MemberPress: Change Stripe Checkout Description
function mepr_change_stripe_checkout_desc($desc, $payment) { if (isset($payment->settings->stripe_checkout_enabled) && $payment->settings->stripe_checkout_enabled == ‘on’) { $desc = “Pay with Apple Pay”; // Edit this. } return $desc; } add_filter(‘mepr_signup_form_payment_description’, ‘mepr_change_stripe_checkout_desc’, 10, 2);Continue reading
MemberPress: Generate All Invoices
function generate_bulk_invoices() { if( isset( $_REQUEST[ ‘generate-invoices’ ] ) ) { global $wpdb; $query = “SELECT id FROM {$wpdb->prefix}mepr_transactions WHERE status in (‘complete’, ‘confirmed’, ‘refunded’)”; $txn_ids = $wpdb->get_results( $query ); foreach( $txn_ids as $txn_id ) { $invoices = new MePdfInvoicesCtrl();…Continue reading
MemberPress: Add Currency Codes To MemberPress
function mepr_currency_codes( $codes ) { array_push( $codes, ‘EGP’ ); // Adds ‘EGP’ to the list of currency codes. To add a different currency, replace EGP with the three-letter currency code of the needed currency. return $codes; // Return the modified…Continue reading
MemberPress: Adjusting Paywall Cookie Expiry Time
add_filter( ‘mepr_paywall_cookie_time’, function( $expire_time ) { // Set cookie expiration time to X days (replace X with the number of days) $expire_time = ( time() + 60 * 60 * 24 * X ); // X represents the number of…Continue reading
Search Atlas
12873467-3b1b-467f-9a92-96a696e8a1c5Continue reading