• Resolved notlicht

    (@notlicht)


    hi!

    i want to get some fields from the billing_adress, so i include this code on invoice.php

    <?php echo get_post_meta($wpo_wcpdf->export->order->id,’_billing_title’,true); ?>
    <?php echo get_post_meta($wpo_wcpdf->export->order->id,’_billing_first_name’,true); ?>
    <?php echo get_post_meta($wpo_wcpdf->export->order->id,’_billing_last_name’,true); ?>

    the field “billing_title” is a dropdown field. i only get the id instead of the name
    —-> 1 instead of “Sir”
    —-> 2 instead of “Mam”

    is there a way to change this?
    Thanks for help

    https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/

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

    (@pomegranate)

    Hi!
    First of all, I generally recommend using the internal functions for custom fields, check out the documentation here: Displaying a custom field.

    For your case, if the billing title is not stored there is no way to get it directly, but you can put the logic in the template:

    <?php
    $billing_title = $wpo_wcpdf->get_custom_field('_billing_title');
    echo ($billing_title == 1) ? 'Sir' : 'Mam';
    ?>

    Hope that helps!
    Ewout

    Thread Starter notlicht

    (@notlicht)

    thank you very much, it is working!

    Plugin Contributor Ewout

    (@pomegranate)

    You’re welcome! If you can spare a minute, I’d really appreciate a review 🙂

    Thanks in advance!
    Ewout

    Thread Starter notlicht

    (@notlicht)

    done 🙂

    Plugin Contributor Ewout

    (@pomegranate)

    Thanks, much appreciated 🙂

    Have a fantastic day!
    Ewout

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘billing_title in pdf’ is closed to new replies.