Last active
January 29, 2018 14:16
-
-
Save shreyans94/66f3bbf5ff52f9a923d4af8a3e5a75a5 to your computer and use it in GitHub Desktop.
Remove woocommerce print invoice and packing slip plugin invoice link from emails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ // only copy this line if needed | |
+/** | |
+ * Remove "View Invoice" link from customer emails | |
+ * or change HTML of the original link button in "View Order" page from "My Account" | |
+ * | |
+ * @param string $button The button HTML | |
+ * @param string $action The current context where the link button is produced ('send_email' or 'print') | |
+ * @return string HTML | |
+ */ | |
+function sv_pip_view_invoice_button_html( $button, $action ) { | |
+ // you can use conditions checking $action so you will know which is the context | |
+ if ( 'send_email' === $action ) { | |
+ // if you want to remove the button link you can just return empty string | |
+ $button = ''; | |
+ } elseif ( 'print' === $action ) { | |
+ // if you need to add some HTML, you could do so: | |
+ $button = '<span class="my-css-class">' . $button . '</span>'; | |
+ } | |
+ return $button; | |
+} | |
+add_filter( 'wc_pip_view_invoice_button_html', 'sv_pip_view_invoice_button_html', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment