• Resolved trollytownstudio

    (@trollytownstudio)


    Hi!

    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.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @trollytownstudio,

    Try this code snippet:

    /**
     * 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 ) {
    	$totals['tax']['label'] = __( 'BTW', 'woocommerce' );
    	return $totals;
    }, 10, 3 );

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Thread Starter trollytownstudio

    (@trollytownstudio)

    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)

    So we are close but not totally there ??

    Thread Starter trollytownstudio

    (@trollytownstudio)

    Hi Yordan, did you have a chance to take a second look? Thank you!

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @trollytownstudio,

    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?

    Thread Starter trollytownstudio

    (@trollytownstudio)

    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.

    Can you taken another look? Thanks in advance.

    Thread Starter trollytownstudio

    (@trollytownstudio)

    Hi Yordan,

    It’s been 4 weeks .. “no” is also an answer ??
    Can you maybe advise me to buy the Pro version?

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @trollytownstudio,

    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 );

    Please try it and let me know if it worked!

    Thread Starter trollytownstudio

    (@trollytownstudio)

    Hi Yordan, I did not get the notify email and just saw your reaction yesterday. Thanks! It works!

    Plugin Contributor Yordan Soares

    (@yordansoares)

    I’m glad to hear that, @trollytownstudio!

    If you don’t mind and have the time, do you think you could leave us a review?

    Thanks in advance and all the best with your store!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Change text’ is closed to new replies.