• Resolved dutchpuppet

    (@dutchpuppet)


    Hi there,

    I’ve succesfully changed the title of the invoice from “factuur” to “Bestelling” with the next filter:

    	add_filter( 'wpo_wcpdf_filename', 'wpo_wcpdf_custom_filename', 10, 4 );
    function wpo_wcpdf_custom_filename( $filename, $template_type, $order_ids, $context ) {
        $invoice_string = _n( 'invoice', 'invoices', count($order_ids), 'woocommerce-pdf-invoices-packing-slips' );
        $new_prefix = _n( 'bestelling', 'bestelling', count($order_ids), 'woocommerce-pdf-invoices-packing-slips' );
        $new_filename = str_replace($invoice_string, $new_prefix, $filename);
     
        return $new_filename;
    }

    However there are still two pieces of text on the invoice that also need to change:
    – invoicedate
    – invoicenumber

    Can you provide me the correct filter to change invoicedate to “besteldatum” and invoicenumber to “bestelnummer”. I can’t seem to find the correct name and line to use. Maybe possible to put a page on your supportsite with useful visual hooks to change?

    Thanx

    Ingrid

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hello Ingrid,
    There are no filters for these translations. You can use the Say What? plugin if you want to make custom translations:

    Original string: Invoice Number:
    Text domain: woocommerce-pdf-invoices-packing-slips
    Replacement string: bestelnummer:

    and

    Original string: Invoice Date:
    Text domain: woocommerce-pdf-invoices-packing-slips
    Replacement string: besteldatum:

    Alternatively, you could create a custom template and replace the strings directly.

    Thread Starter dutchpuppet

    (@dutchpuppet)

    I’ve tried the Loco translate plugin, unfortunately this doesn’t work. For now i’ve been making the change directly in the plugin invoice.php using:

    		<?php do_action( 'wpo_wcpdf_before_order_data', $this->type, $this->order ); ?>
    				<?php if ( isset($this->settings['display_number']) ) { ?>
    				<tr class="invoice-number">
    					<th><?php _e( 'Bestelnummer:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
    					<td><?php $this->invoice_number(); ?></td>
    				</tr>
    				<?php } ?>
    				<?php if ( isset($this->settings['display_date']) ) { ?>
    				<tr class="invoice-date">
    					<th><?php _e( 'Besteldatum:', 'woocommerce-pdf-invoices-packing-slips' ); ?></th>
    					<td><?php $this->invoice_date(); ?></td>
    				</tr>

    But this is gone when there is an update…

    Plugin Contributor kluver

    (@kluver)

    Hi @dutchpuppet,

    To make sure your changes are not overwritten when updating you will need to create a custom template and add your customizations there.

    Plugin Contributor Ewout

    (@pomegranate)

    Also note that the Say What plugin works quite differently from Loco Translate. Loco Translate edits the language packs and if an update is available from www.remarpro.com, these will be overwritten. Say What simply overrides translations one by one, regardless of language packs.

    Thread Starter dutchpuppet

    (@dutchpuppet)

    You’re right. Just did that. Thanx. Just a little question… in the invoice.php template the adressnumber is shown on a second line underneath the adress. In the Netherlands we put this behind the adress. What should I change to put it there?

    Plugin Contributor Ewout

    (@pomegranate)

    This must be a customization (or error) in your checkout. WooCommerce has two lines for the address, the first is “Straat en huisnummer” (_billing_address_1) and the second “Appartement, suite, unit etc. (optioneel)” (_billing_address_2). WooCommerce formats this address according to international rules and does not separate the “Straat en huisnummer”. You’ll see the same formatting being used accross WooCommerce in emails and the backend.

    If you want to put _billing_address_1 and _billing_address_2 on the same line you need to modify the address format: Changing the address format

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change text on invoice with filter’ is closed to new replies.