MemberPress: Display Purchase Information With Shortcode
The code snippet registers a new shortcode: [purchase_info]. Adding this shortcode will display the latest MemberPress purchase information for the currently logged-in user, including the purchase value, transaction ID, and user’s email.
The sample code will display the latest MemberPress purchase value in US dollars ($). In addition, the code will show the “No purchase information found.” message if the user has no purchases.
To adjust the currency, the code snippet should to be manually adjusted by replacing the currency symbol or formatting on these lines:
Purchase Value: $" . number_format($value, 2) . "
To modify the message displayed in case the user has no purchases, replace the “No purchase information found.” Text with the new test on this line:
Comments