Support » Plugin: WooCommerce PDF Invoices & Packing Slips » Display FREE instead of $0.00 on the pdf receipt

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ewout

    (@pomegranate)

    Hi! The screenshot you posted here does not look like it’s coming from our PDF invoices plugin. Is this a custom template or are you perhaps using another plugin?

    Thread Starter tonijeto

    (@tonijeto)

    Thank you for a quick reply.
    It is a slightly changed template but we are using your plugin for sure.
    https://prnt.sc/vgrjtt
    Since it is a real order, I did not want to reveal customer info.
    Thanks

    Plugin Author Ewout

    (@pomegranate)

    I see. You can use the following filter to show FREE instead of 0.00:

    
    add_action( 'wpo_wcpdf_before_html',function(){
    	add_filter( 'wc_price', 'wpo_wcpdf_format_free', 9999, 4 );
    });
    add_action( 'wpo_wcpdf_after_html',function(){
    	remove_filter( 'wc_price', 'wpo_wcpdf_format_free', 9999, 4 );
    });
    function wpo_wcpdf_format_free( $price_html, $formatted_price, $args, $unformatted_price ){
    	if ( $unformatted_price == 0.0 ) {
    		$price_html = 'FREE';
    	}
    	return $price_html;
    }
    

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

    Thread Starter tonijeto

    (@tonijeto)

    Thank you for your help. The code works.
    Since I have a pro version with credit note addition, is there any way to not use “FREE instead of $0” on a credit note pdf document?
    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display FREE instead of $0.00 on the pdf receipt’ is closed to new replies.