Total/ Subtotal Help
-
Hello,
I am trying to change “Total” to custom text, but I cannot figure out where to change it in invoice.php. Also, I would like to remove the subtotal completely.
Thank you for your help!
Best,
Matt
-
Hi! To change that label you have to use the filter
wpo_wcpdf_woocommerce_totals, which filters an array of the totals. The total and subtotal itself are not editable directly inside invoice.php because they are dynamic and this printed based on the available data (just like the order items).Here’s the basic setup for this filter:
add_filter( 'wpo_wcpdf_woocommerce_totals', 'wpo_wcpdf_woocommerce_totals_custom', 10, 3 ); function wpo_wcpdf_woocommerce_totals_custom( $totals, $order, $document_type ) { // Do your magic here return $totals; }Much easier is the Premium Templates extension, which lets you do this in a drag & drop interface and also add much more informations (split out taxes, change prices to include or exclude tax, etc).
Hope that helps!
EwoutThanks for your help Ewout! Am I able to turn off subtotals and edit the total label in the premium version?
Best,
Matt
Yes!
By the way, hiding the subtotal in the free version is also possible with CSS:
.totals.cart_subtotal { display:none; }Hope that helps!
EwoutI actually bought the premium version, thanks for recommending it. I am only having trouble with one thing now. I want to replace the title “Invoice” with “Receipt”. I managed to do it on the free simple template, but I can’t seem to find where to change it on the premium.
Thanks for all your help.
Best,
Matt
Hi Matt, this is the same in both the Simple and the premium templates:
https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/change-the-document-title/If you have any other questions regarding the premium templates, please email us at support@wpovernight.com instead. WordPress.org does not allow us to use these forums for premium support.
-
This reply was modified 8 years, 8 months ago by
Ewout.
Thanks so much for all your help.
I came across a couple more questions, sorry. Is it possible to change the attachment and slug name so that “invoice” is replaced with other text? Also, in woocommerce on the “My Account” page there is a button to “Download Invoice (PDF)”. Is it possible to change this?
Sorry for all the questions, and thanks for the help.
Best,
Matt
Hi Matt,
Sure, check out the documentation:
Custom PDF filenames
Change My Account button text:
wpo_wcpdf_myaccount_button_textHope that helps!
EwoutThank you
You have been so much help thank you Ewout. Last thing I am having issues with is inserting an image in an additional text field or footer. I have added an image in both and they work for a while, but then start to return “Image not found or type unknown”. I am using an img tag and have tried both jpg and png. Any ideas?
It’s possible your server is blocking remote images. If you use a server path instead it will not have this issue.
Inserting images
If you don’t know the path to your site on the server, you can check the Status tab of the PDF invoice settings for reference. Copy the first part from the ‘Central temporary plugin folder’, up to /wp-content/ (depending on where the file is of course).Thanks for the advice Ewout. It is quite strange, I tried the server path option and it didn’t work. I went back to the normal image URL and it seems to be working again. I am hoping it doesn’t break on me again!
-
This reply was modified 8 years, 8 months ago by
The topic ‘Total/ Subtotal Help’ is closed to new replies.