• Resolved casing12

    (@casing12)


    I want to display both ‘ship to’ and ‘bill to’ address every time even if they are same. Could you please let me know how to do it.

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

    (@pomegranate)

    Hi! To accomplish this, you will need to enable the setting “Display shipping address” in the Invoice document settings, and add the following code snippet to your site:

    
    add_filter( 'wpo_wcpdf_ships_to_different_address', '__return_true' );
    

    Read this if you haven’t worked with functions.php or code snippets like this before: How to use filters.
    Note that by default the setting “Display shipping address” will not affect existing invoices (that were created before enabling this), unless you enable the option “Always use most current settings” in the Invoice document settings too.

    Hope that helps, wishing you all the best for 2019!

    Thread Starter casing12

    (@casing12)

    Thank you so much and wish you a very happy new year!

    It worked very well. It is showing both the addresses now. I want to add the heading above ‘Bill TO:’ address just like it comes in ‘Ship to:’. Where can I make these changes?

    Plugin Contributor Ewout

    (@pomegranate)

    You can add this with a small code snippet:

    
    add_action( 'wpo_wcpdf_before_billing_address', 'wpo_wcpdf_before_billing_address_invoice', 10, 2 );
    function wpo_wcpdf_before_billing_address_invoice( $document_type, $order ) {
    	if ($document_type == 'invoice') {
    		echo "<div>Bill to:</div>";
    	}
    }
    

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

    Or if you plan to make more changes, you could create a custom template and directly put it in the template file instead.

    Thread Starter casing12

    (@casing12)

    I already have custom template and added the code in invoice.php file but it did not work. ‘Bill to’ heading is not coming. Only billing address is displayed.

    Thread Starter casing12

    (@casing12)

    sorry, I tried again and added it in child’s function php file and it is working fine now.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘display both ship to and bill to address’ is closed to new replies.