• Resolved gerard04

    (@gerard04)


    I’ve seen in the FAQ that it say you can put a code in functions to change the name i just copy paste and change the name but when i receive the invoice it does not change

    Here is the code i put

    add_filter( 'wpo_wcpdf_invoice_title', 'wpo_wcpdf_invoice_title', 10, 2 );
    function wpo_wcpdf_invoice_title ( $title, $document ) {
        $title = 'Comanda';
        return $title;
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    Hello @gerard04,

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

    Let me know if it works ??

    Thread Starter gerard04

    (@gerard04)

    I already have some actions/filters on my functions php that they work I just added the snipet at the bottom maybe theres something that brokes the filter? Here I leave all my functions.php

    <?php
    /**
     * Use this file for all your template filters and actions.
     * Requires WooCommerce PDF Invoices & Packing Slips 1.4.13 or higher
     */
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_add_woo_delivery_data', 10, 2 );
    function wpo_wcpdf_add_woo_delivery_data( $template_type, $order ) {
    	$document = wcpdf_get_document( $template_type, $order );
    	$delivery_data = array( 'delivery_date', 'delivery_time', 'pickup_date', 'pickup_time' );
    	foreach( $document->get_woocommerce_totals() as $key => $total ) {
    		if ( in_array( $key, $delivery_data ) ) {
    			?>
    			<tr class="woo-delivery">
    				<th><?php echo $total['label']; ?></th>
    				<td><?php echo $total['value']; ?></td>
    			</tr>
    			<style>table.totals tr.<?php echo $key; ?> { display: none; }</style>
    			<?php
    		}
    	}
    }
    add_action( 'wpo_wcpdf_custom_styles', 'wpo_wcpdf_bold_sku', 10, 2 );
    function wpo_wcpdf_bold_sku ( $document_type, $document ) {
      ?>
      dd.sku {
        font-weight: bold;
      }
      
      <?php
      
    }
    add_filter( 'wpo_wcpdf_invoice_title', 'wpo_wcpdf_invoice_title', 10, 2 );
    function wpo_wcpdf_invoice_title ( $title, $document ) {
        $title = 'Comanda';
        return $title;
    }
    
    Plugin Contributor Yordan Soares

    (@yordansoares)

    I don’t see any issues with your code.

    Did you make sure you have activated the theme where you put the code?

    Thread Starter gerard04

    (@gerard04)

    Yes it i have selected the right template

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Could you please try installing the Code Snippets plugin and adding the snippet to your site in order to rule out isn’t being overriding by other code?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘trying to change the document name’ is closed to new replies.