How to Hide/Change the Download Invoice Button on Your Customer Dashboard
For certain unique situations, you might prefer to use your own invoices or receipts, or even exclude SureCart’s default ones from the customer dashboard.
Here’s what the download invoice button looks like on your customer’s dashboard:
Fortunately, SureCart provides a PHP filter to do this. You just need to add this filter to your functions.php file.
You can use a code snippets plugin or integrate it through an alternative method to implement this change.
How to Add this Code to Your WordPress Site
In this article, we use this Code Snippets plugin to integrate the provided code into our functions.php file.
However, feel free to use any code snippet plugin you prefer.
- Copy the following code.
add_action(
'surecart/order/set_attribute',
function( $attribute, $name ) {
if ( 'statement_url' !== $name ) {
return $attribute;
}
return ''; // you can also customize this.
},
10,
2
);
- Navigate to your WordPress dashboard’s Functions (PHP) section under Snippets > All Snippets.
- Click on the Add New button at the top.
- Paste the copied code snippet in this box. You can also give a title and description for this snippet here.
- Once you’re done, click on the Save Changes and Activate button below.
Congrats! The snippet is now activated on your site.
Navigate to your customer dashboard now to see if the Download Receipt/Invoice button is still visible or not.
You can customize the above code to change the invoice URL according to your preferences.
That’s it! Hope this solution helped you. If you face any issues while integrating this code or still see the download button, please reach to our support team. We’re always here to help.
We don't respond to the article feedback, we use it to improve our support content.