• Resolved thijsbrouwer

    (@thijsbrouwer)


    On my PDF slip it says the amount of BTW (VAT). However currently I have an exemption on VAT (which means, formally, it is not 0%)

    I would like to change this comment on my pdf slip. Somebody who can help doing that?

    Thank you!

    regards, Thijs

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

    (@yordansoares)

    Hi @thijsbrouwer,

    If I’m understanding correctly, you want to replace the VAT sentence with something else when the VAT is 0% right? Or do you just want to delete the sentence altogether?

    Thread Starter thijsbrouwer

    (@thijsbrouwer)

    Hi @yordan soares

    Yes! currently I would like to replace this sentence (in all cases related to my webshop) with something saying that there is no VAT applicable.

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Thanks for providing more details, @thijsbrouwer:

    Try the following code snippet to customize that text when the order has zero tax:

    /**
     * PDF Invoices & Packing Slips for WooCommerce:
     * Customize texts on the PDF documents (gettext)
     */
    add_filter( 'wpo_wcpdf_html_filters', function( $filters, $document ) {
    	// If order tax is equal to zero...
    	if ( $document->order->get_total_tax() == 0 ) {
    		// ...customize the VAT sentence 
    		$filters[] = array( 'gettext', 'wpo_wcpdf_customize_string_translation', 999, 3 );
    	} 
    	return $filters;
    }, 10, 2 );
    function wpo_wcpdf_customize_string_translation( $translation, $text, $domain ) {
    	if ( $domain == 'woocommerce' ) { // Change this for the actual plugin slug
    		switch ( $text ) {
    			// Repeat as many cases as strings you want to translate
    			case '(includes %s)':
    				$translation = '(no VAT applicable)';
    				break;
    		}
    	}
    	return $translation;
    }

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

    Thread Starter thijsbrouwer

    (@thijsbrouwer)

    thank you very much!

    I’ve a little remark; the note ‘no VAT applicable’ is currently valid for all my invoices, i think the restriction ‘order —> get_total_tax()’ is not necessary and that might make it a little easier?

    thanks for your help!

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi, @thijsbrouwer:

    If all your orders are VAT exempt, then you could try the following code snippet instead, which remove the condition you have mentioned, applying the customization to all your PDF invoices:

    /**
     * PDF Invoices & Packing Slips for WooCommerce:
     * Customize texts on the PDF documents (gettext)
     */
    add_filter( 'wpo_wcpdf_html_filters', function( $filters, $document ) {
    	$filters[] = array( 'gettext', 'wpo_wcpdf_customize_string_translation', 999, 3 );
    	return $filters;
    }, 10, 2 );
    function wpo_wcpdf_customize_string_translation( $translation, $text, $domain ) {
    	if ( $domain == 'woocommerce' ) { // Change this for the actual plugin slug
    		switch ( $text ) {
    			// Repeat as many cases as strings you want to translate
    			case '(includes %s)':
    				$translation = '(no VAT applicable)';
    				break;
    		}
    	}
    	return $translation;
    }
    Thread Starter thijsbrouwer

    (@thijsbrouwer)

    Thank you @yordansoares !!

    It works great!

    • This reply was modified 11 months, 1 week ago by thijsbrouwer.
    Plugin Contributor Yordan Soares

    (@yordansoares)

    I’m very glad to hear that, @thijsbrouwer!

    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 7 replies - 1 through 7 (of 7 total)
  • The topic ‘PDF slip’ is closed to new replies.