PDF Attachment – Custom Hooks
PDF Template One/Two have the same setup on the intial stage.
Both come with custom hooks to insert new text in the templates. Each hook have one parameter added – the order object.
Any custom meta data attached to the order can be extracted and displayed in the template.
How to use hooks to display custom info in the pdf ?
Go to Active Template ->Theme Editor -> Theme Functions
Inside the php add a function and a hook, for this example we will display custom info before the header of the pdf.( hook raffle_play_woo_pdf_before_header_one)
add_action('raffle_play_woo_pdf_before_header_one', 'my_custom_function_raffle', 10, 1 ); function my_custom_function_raffle( $order ){ //you can extract custom meta data from $order object and display it echo "<p> This is order " . $order->get_id() . "</p>"; echo "<p> Thank you for using this plugin </p>"; }
Template One Hooks
Action Hook | Position on Template |
raffle_play_woo_pdf_before_header_one
|
Before header section |
raffle_play_woo_pdf_after_header_one
|
After header section |
raffle_play_woo_pdf_after_billing_info_one
|
After Billing Info |
raffle_play_woo_pdf_after_after_product_display_one
|
After product grid info |
raffle_play_woo_pdf_after_after_raffle_info_one
|
After the raffle grid info |
Template Two Hooks
Action Hook | Position on Template |
raffle_play_woo_pdf_before_header_two
|
Before header section |
raffle_play_woo_pdf_after_header_twp
|
After header section |
raffle_play_woo_pdf_after_billing_info_two
|
After Billing Info |
raffle_play_woo_pdf_after_after_product_display_two
|
After product grid info |
raffle_play_woo_pdf_after_after_raffle_info_two
|
After the raffle grid info |