WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce Print Invoice & Delivery Note
I can't add Custom Fields on the invoice (9 posts)

  1. SimonBak
    Member
    Posted 8 months ago #

    Hi,

    I just download your great plugin and i try to add custom fields on the invoice with the method explain on the FAQ :

    How do I add more info or custom fields to the templates?
    Create a custom template (see questions above). Then edit the file to your needs. You can use all functions that are available in WordPress or any activated plugin or theme.

    Example: Show an order custom field that was added by another plugin (e.g. '_my_custom_field')

    echo wcdn_get_order_custom_field('_my_custom_field');

    But that doesn't work.
    Can you help me please.
    Thanks for your time.

    Simon.

    http://wordpress.org/plugins/woocommerce-delivery-notes/

  2. rafaelfranchin
    Member
    Posted 7 months ago #

    Hi @SimonBak

    Two steps:

    1. woocommerce-delivery-notes.php

    Add this code and replace my_custom_field with your custom field:

    if ( !function_exists( 'wcdn_my_custom_field' ) ) {
    	function wcdn_my_custom_field() {
    		global $wcdn;
    		echo $wcdn->print->get_order()->my_custom_field;
    	}
    }

    2. templates\print\print-delivery-note.php

    Add this code wherever you want it to appear in the page and replace my_custom_field with your custom field::

    <?php wcdn_my_custom_field(); ?>

    Hope it helps!
    Rafael

  3. SimonBak
    Member
    Posted 7 months ago #

    Hi @Rafaelfranchin,

    Thanks for your answer. I try it but it doesn't works for my website.
    I use the plugin "WooCommerce Checkout Manager Pro" for add more fields on the checkout page and i want to see this fields on my invoice.

    Have you an other idea ?
    Thanks for your help.

    Simon.

  4. garl
    Member
    Posted 3 months ago #

    Hey Simon. Did you ever find a solution for this?

  5. SimonBak
    Member
    Posted 3 months ago #

    Hello,

    Sorry and yes i found a solution.
    I use this code

    <?php
    $yourvariable = get_post_meta($wpo_wcpdf->export->order->id,'<strong>your_custom_fields</strong>',true);
    if (isset($yourvariable)) {
    	echo $yourvariable;
    }
    ?>

    I hope that will work for you.

  6. SimonBak
    Member
    Posted 3 months ago #

    This code

    <?php
    $yourfield = get_post_meta($wpo_wcpdf->export->order->id,'<strong>your_custom_field_name</strong>',true);
    if (isset($yourfield)) {
    	echo $yourfield;
    }
    ?>

    I hope that will work for you.

  7. SimonBak
    Member
    Posted 3 months ago #

    This code it's find (without the

    <?php
    $yourfield = get_post_meta($wpo_wcpdf->export->order->id,'your_custom_field_name',true);
    if (isset($yourfield)) {
    	echo $yourfield;
    }
    ?>

    I hope that will work for you.

  8. garl
    Member
    Posted 3 months ago #

    I'll give it a try, thanks. :)

  9. Ewout
    Member
    Posted 3 months ago #

    Hi There,
    This code only works for the WooCommerce PDF Invoices & Packing Slips plugin!

Reply

You must log in to post.

About this Plugin

About this Topic