Customize PDF Invoice Fields
-
Hello, is there a way to unable or disable fields so they don’t show up on PDF invoice? if yes, from where we can do that?
The page I need help with: [log in to see the link]
-
Hi @donarajaghinyan,
Yes, you can hide info from the PDF documents, although depending on the info you want to hide, you would need to follow different instruction, like enabling/disabling options from the document settings, filtering the data, using filter hooks, or using CSS rules.
If you provide more details about what you want to do, I can point you to the right direction for your specific case ๐
Thanks for the quick reply.
So it a catering website. People are putting their orders. and when we want to print the invoice it has
Order Date:
Delivery Date:
it is causing some confusion. We want to remove “order date” from the invoice document. Is it possible?Thanks for providing more details, @donarajaghinyan:
After adding the following code snippet in your site, the order date will be hidden:
/** * PDF Invoices & Packing Slip for WooCommerce: * Add custom styles to the PDF documents */ add_action( 'wpo_wcpdf_custom_styles', function( $document_type, $document ) { ?> /* Hide the order date */ .order-date { display: none; } <?php }, 10, 2 );If you haven’t worked with code snippets (actions/filters) or
functions.phpbefore, read this guide: How to use filtersoh no, it has to be changed in PHP code ๐ any way to do via CSS or without code??
Actually, this code snippet injects a CSS rule to your PDF documents. If you do not want to use this PHP code snippet, you will need to create a custom PDF template.
seems like this is more complicated — assuming the code you provided will be changed in .php file.
can you advice where exactly it would go?
at the beginning of the code or at the end or specific file?If you have a child theme, you can add code snippets in its
functions.phpfile: don’t add code snippets to thefunctions.phpfile from your parent theme, because you may lose your customizations after updating your parent theme!The another way to add code snippets, that is safer in my humble opinion, is to use the Code Snippets plugin: This plugin stores the code snippets in your database, so you don’t have to worry about losing your customizations after updating your plugins or theme ๐
amazing support, you guys are the best :)) appreciate for the plugin – i used it and the code worked :)))
THANK YOU
I’m glad to hear that you finally managed to activate it! ๐ช
If you don’t mind and have the time, do you think you could leave us a review?
Thanks in advance and all the best with your store!
Of course, with pleasure. doing now.
One more thing, if you can help me with a code snippet that would be highly appreciated ๐Is it possible, when they place the order, indicate not only the date (on the pdf invoice), but the day of the week too?
Like:
Delivery Date: Friday, 6/23/2023
Also, to change the format.
Like 6/23/2023 instead of 2023/6/23
Hi @donarajaghinyan,
Please add this code snippet in your site to customize the PDF document’s date:
/** * PDF Invoices & Packing Slips for WooCommerce: * Customize the invoice date (e.g. Sunday, 12/31/2023) */ add_filter( 'wpo_wcpdf_date_format', function( $date_format, $document, $date_type ) { $date_format = 'l, m/d/Y'; return $date_format; }, 10, 3 );Let us know if you need anything else!
P.S.: Thank you very much for the great review! โค๏ธ
hello, thanks a lot for the quick reply.
Hmmm seems like the code didn’t work the “Delivery Date” still shows as YYYY/MM/DD >>>> we want it to be, Weekday (e.g. Friday etc), Day of the week, MM/DD/YYYY
hope this video helps ))): https://www.loom.com/share/7076fdfe5c114c929ceda0cc79358188?sid=1d1fb1f5-2a1e-4f24-a434-72a5272928f0Hi @donarajaghinyan.
The code snippet above is to customize the date in our PDF documents. For dates added by third-party plugins, you could try adding
l, m/d/Yunder Dashboardย > Settingsย > Generalย > Dateย Formatย > Within the Custom field.hello, thanks a lot. I did the changes in the Dashboard – but seems like it still didn’t change the PDF invoice “Delivery Date” format ((
Could you please tell me how are you adding the delivery date in your PDF invoices, so I can try to help you further, as courtesy?
The topic ‘Customize PDF Invoice Fields’ is closed to new replies.