Changing Memberpress Recurring Product Description at Checkout

Software: WordPress
Plugin: Memberpress
Plugin: My Custom Functions

Overview

Memberpress is a plugin for WordPress that allows the owner of the website to create a powerful member based website. It allows you to lock out certain pages unless the user has signed up for a specific membership, all based on rules you set in the backend.

When a user purchases a membership on the website, they are directed to a payment portal that has the description of what they’re about to buy and asks them to input a payment method. It looks something similar to this.

Memberpress Checkout Description Change

Changing Memberpress Checkout Item Description

Circled above is Initial Payment. It’s a setting that cannot be changed in the Memberpress dashboard in the backend. Why not?! Who knows!

I suspect that this description has something to do with selecting the recurring payment when creating the membership.

To change what it says here, a little Javascript is required. If you do not have a plugin installed, I would suggest using a plugin to insert the javascript. If you do not use a plugin, and instead edit the functions.php file, with one theme update, you will lose your customization and have to do it again (smart WordPress practice is to avoid this sort of issue). At the time of writing this article, My Custom Functions seemed like the smartest plugin to use to edit the php/javascript.

Once the plugin My Custom Functions has been installed, it is located under settings -> PHP Inserter.

Add the following code:

function change_checkout_description($args, $txn) {
	$membership = new MeprProduct($txn->product_id);
	$args['items'][0]['description'] = $membership->post_title . ' - Initial Payment';
	return $args;
}
add_filter('mepr-invoice', 'change_checkout_description', 10, 2);

In the above code, change ‘ – Initial Payment ‘ to what you would like it to be.

Save the custom code, and you should see changes reflected on the front end of your website.

Hope this helps!

Leave a Reply

twenty + twenty =