When viewing the options page in the preview canvas I can see my PDF. Underneath “subtotaal” and “verzending” I have “belasting”. I would like to change the text “belasting” to “BTW”. I searched in the Loco Translate plugin and tried changes inside the Woocommerce Tax settings (changed the tax_rate_name) but was not succesfull. Can you show me where to change this? Thanks in advance.
Hi Yordan, first of all thanks for the very quick respons. Your code spits out an extra row just underneath “totaal” . So with your code now I have: (text) subtotaal – (value) (text) verzending – (value) (text) belasting – (value) (text) totaal – (value) (text) BTW – ( no value)
Sorry the late reply! Could you please remove the code snippet above and send me a screenshot of the current output of your PDF invoices, so I can understand where the ‘belasting’ text is being displaying?
Hi Yordan, I think my last mail was not delivered or something anyway .. my question is still “open”. I’m looking for a way to translate the text of a label. In the uploaded image you can see that:
under 1. the label now says “belasting” and I would like to change that to “21% BTW”
under 2. with the code snippet you send me earlier this happened. There was a label “btw” but this appeared underneath the “total” row
under 3. I already tried to change the text label in the standard tax rate edit field in woocommerce. That did not work.
Sorry for the late reply! The easiest way to achieve this, is using the customizer, included in the Premium Templates extension: You can customize the labels within all the blocks, like this:
However, I have written a new code snippet for you:
/**
* PDF Invoices & Packing Slips for WooCommerce:
* Customize the VAT label on the PDF documents.
*/
add_filter( 'wpo_wcpdf_woocommerce_totals', function( $totals, $order, $document_type ) {
foreach ( $totals as $total_id => $total ) {
if ( $total['label'] == 'Belasting') {
$totals[$total_id]['label'] = __( 'BTW', 'woocommerce' );
break;
}
}
return $totals;
}, 10, 3 );