Created
July 31, 2024 15:36
-
-
Save kilbot/0a6a05f34a9b17bef46562e28e65f836 to your computer and use it in GitHub Desktop.
Adding custom text to PDF Invoices & Packing Slips for WooCommerce
This file contains 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
<?php | |
/** | |
* Add this to your theme's functions.php file to display text on the PDF template. | |
* | |
* Options for positioning the text: | |
* - wpo_wcpdf_before_document | |
* - wpo_wcpdf_before_shop_address | |
* - wpo_wcpdf_after_shop_address | |
* - wpo_wcpdf_before_shop_logo | |
* - wpo_wcpdf_after_shop_logo | |
* - wpo_wcpdf_before_shop_name | |
* - wpo_wcpdf_after_shop_name | |
* - wpo_wcpdf_before_document_label | |
* - wpo_wcpdf_after_document_label | |
* - wpo_wcpdf_before_billing_address | |
* - wpo_wcpdf_after_billing_address | |
* - wpo_wcpdf_before_shipping_address | |
* - wpo_wcpdf_after_shipping_address | |
* - wpo_wcpdf_before_order_data | |
* - wpo_wcpdf_before_order_details | |
* - wpo_wcpdf_templates_before_order_details_row | |
* - wpo_wcpdf_templates_after_order_details_row | |
* - wpo_wcpdf_before_document_notes | |
* - wpo_wcpdf_after_document_notes | |
* - wpo_wcpdf_before_customer_notes | |
* - wpo_wcpdf_after_customer_notes | |
* - wpo_wcpdf_after_order_details | |
* - wpo_wcpdf_after_document | |
*/ | |
function wpo_wcpdf_add_custom_text_for_email_invoice_gateway( $type, $order ) { | |
if( $order->get_payment_method() === 'wcpos_email_invoice' ) { | |
echo '<div style="text-align: center; font-weight: bold;">Gelieve de rekening binnen 8 dagen te betalen.</div>'; | |
} | |
} | |
add_action( 'wpo_wcpdf_after_order_details', 'wpo_wcpdf_add_custom_text_for_email_invoice_gateway', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment