Plugin Contributor
Ewout
(@pomegranate)
Hi! Here’s a link to the documentation page that describes how to add the download PDF button on the thank you page:
https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/download-link-on-the-thank-you-page/
To make it WPML compatible, instead of:
$text .= '<p><a href="'.esc_attr($pdf_url).'">Download a printable invoice / payment confirmation (PDF format)</a></p>';
use:
$text .= sprintf( '<p><a href="%s">%s</a></p>', esc_attr($pdf_url), __( 'Download Invoice (PDF)', 'woocommerce-pdf-invoices-packing-slips' ) );
Adding the button to the View Order page is a bit more limited, because by default WooCommerce only has one action here (your theme may have more, but you’d have to check for yourself): woocommerce_view_order
This is at the very bottom of the page…
Here’s an example that uses this action:
add_action( 'woocommerce_view_order', 'woocommerce_view_order_pdf_button', 10, 1 );
function woocommerce_view_order_pdf_button( $order_id ) {
$pdf_url = wp_nonce_url( admin_url( 'admin-ajax.php?action=generate_wpo_wcpdf&template_type=invoice&order_ids=' . $order_id . '&my-account'), 'generate_wpo_wcpdf' );
printf( '<p><a href="%s">%s</a></p>', esc_attr($pdf_url), __( 'Download Invoice (PDF)', 'woocommerce-pdf-invoices-packing-slips' ) );
}
Hope that helps!
if you need more help with this, don’t hesitate to send us an email at support@wpovernight.com – wordpress.org does not allow us to provide support for our premium products via these forums.
Ewout
Thread Starter
eppu
(@eppu)
Thank you,
I will try this out today.
-
This reply was modified 5 years, 8 months ago by
eppu.
Thread Starter
eppu
(@eppu)
Thank you it worked wonderfully.
Plugin Contributor
Ewout
(@pomegranate)
Fantastic, very glad to hear that 🙂
Have a great week!
Ewout