EDD Receipt shortcode
After completing a purchase, the complete details of the purchase can be displayed to the customer with the
[edd_receipt] shortcode. This will display a detailed breakdown of what the customer purchased, the amount of their purchase, the date, the receipt ID, and more.
The purchase summary looks like this:
You can use the shortcode as follows:
It is best if this is placed on the purchase success page.
If you want to modify the receipt page output, here is a list of supported parameters:
- ‘error’ – to change the default error message displayed when the receipt is not viewable: error=”Your error message goes here.”
- ‘price’ – the price of the purchased item(s).
- ‘discount’ – the discount code used.
- ‘products’ – displays the products purchased.
- ‘date’ – the date of purchase.
- ‘payment_key’ – the unique identifier for the order.
- ‘payment_method’ – shows the payment gateway used for the purchase.
- ‘payment_id’ – displays the order number.
Unless otherwise noted, all shortcode attributes can be disabled by giving them a value of ‘0’. For example, to disable the purchase date on your receipt page and change the default error message:
[edd_receipt date="0" error="Unfortunately, the receipt cannot be viewed."]
Possible reasons why a receipt may not be viewable:
There are times when viewing the receipt page that a receipt will not be viewable. By default, you would get this error message: “Trouble retrieving payment receipt.”
1. Direct Viewing.
If you are viewing a page with the
[edd_receipt] shortcode on it directly, you could see an error. Typically, the
[edd_receipt] shortcode will be placed on your Purchase Confirmation page – which Easy Digital Downloads will link to from several places. When it links to that page, it includes information about which payment it is for. If you simply go to Dashboard > Pages > View Page for your Purchase Confirmation page, it will show an error because it does not know which receipt it is supposed to show. This is nothing to worry about because your users will only be redirected to that page by Easy Digital Downloads.
2. Aggressive caching.
If your site has aggressive caching, it can result in the
[edd_receipt] shortcode not working correctly. You can try disabling your caching on the Checkout and Purchase Confirmation pages. You may need to get your web host to do this for you if you are not sure how.
3. Conflicting Plugins.
It is possible that a plugin you have installed is causing a conflict. To rule that out, try deactivating all plugins except Easy Digital Downloads and making a test purchase. If the purchase receipt then shows correctly, you know the problem was being caused by one of those now-inactive plugins. To deactivate plugins in WordPress, go to the Dashboard > Plugins page and click “deactivate” beside each plugin.