I created metabox in function.php file which allow admin to download pdf file.
When admin clicks on button “Print”, pdf file generated and sent to browser.
Function that generates pdf attached to ‘woocommerce_process_shop_order_meta’ action, which triggered by clicking on button “Print”.
This is not convenient because action ‘woocommerce_process_shop_order_meta’ called everytime when admin updates order and every time pdf file downloaded. When button clicked i want only download pdf file and i want to call that function by clicking on that button, but do not know how to do it in right way. I’m looking in javascript/ajax way but may be there is better solution.
Thank you, for patience and help.
]]>Thanks for your question!
I understand that you’re trying to create a custom feature on the order page adding the capability to print off the order.
Perhaps you want to consider using the following plugin: WooCommerce Print Invoices & Packing lists.
From the description, it seems to meet your requirement:
This plugin allows you to easily print documents for orders straight from the Orders page (individually and in bulk), while editing orders, and allows customer to view invoices from the “My Account” page.
I hope that helps!
]]>We’ve not heard back from you in a while so I’ll go ahead and mark this thread as resolved. I hope you will find the above information useful.
Please feel free to create a new thread if you have further questions.
Thanks.
]]>