Plugin Contributor
Ewout
(@pomegranate)
There’s some documentation on this subject here: Change the document title
To replace the invoice title with the order number, you can use the following snippet:
add_filter( 'wpo_wcpdf_invoice_title', 'wpo_wcpdf_invoice_title', 10, 2 );
function wpo_wcpdf_invoice_title ( $title, $document ) {
if (!empty($document->order)) {
$title = $document->order->get_order_number();
}
return $title;
}
Do note that this will change the title on the buttons too. If you only want to change the title in the document itself, you will need to create a custom template.
Thank you this works perfectly on the invoice!
When you say buttons, do you mean the buttons on the orders page? Also, is there a way to include a # before the order number?
Thank you
Got it working with:
add_filter( 'wpo_wcpdf_invoice_title', 'wpo_wcpdf_invoice_title', 10, 2 );
function wpo_wcpdf_invoice_title ( $title, $document ) {
if (!empty($document->order)) {
$title = '#'.$document->order->get_order_number();
}
return $title;
}
thanks for your help!
@pomegranate do you also know if there is a way to move the logo to the top right instead of the top left?
I tried using:
add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles', 10, 2 );
function wpo_wcpdf_custom_styles ( $document_type, $document ) {
?>
td.shop-info {display: none !important;}
td.header > img {float:right !important;}
<?php
}
Whilst this did move the logo to the right, it sat on top of some other text.
Kind regards,
Hello @danb3434
Try this:
add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles', 10, 2 );
function wpo_wcpdf_custom_styles ( $document_type, $document ) {
?>
td.shop-info {display: none !important;}
td.header > img {float:right !important; margin-right: 40%;}
<?php
}
Hi @alexmigf,
Thanks for the suggestion, I just tried it and it kind of moved the logo into the middle of the page.
See the original issue here:
View post on imgur.com
Kind regards,
Hello @danb3434
Can you show me where to want to place it?
Hi @alexmigf, thanks for the quick reply!
I’m looking to have the logo on the right, the original code I showed did do this, so the location of the logo is correct.
The issue though is that it is now sitting on top of other pieces of text. See the full invoice here:
View post on imgur.com
Let me know if I can clarify any further.
Hi @danb3434
Try this:
add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_custom_styles', 10, 2 );
function wpo_wcpdf_custom_styles ( $document_type, $document ) {
?>
td.shop-info { display:none; }
td.header { text-align:right; }
<?php
}
Let me know.
@alexmigf works perfectly, thank you for your help!!