• Resolved fgauttron

    (@fgauttron)


    Hello,

    We have a custom template with custom fields. After the last update, some customs fields are no longer displayed. Here is the part of our code :

    <h3><?php $wpo_wcpdf->custom_field(‘_billing_civilite’); ?> <?php $wpo_wcpdf->custom_field(‘_billing_first_name’); ?> <?php $wpo_wcpdf->custom_field(‘_billing_last_name’); ?></h3>
    <h3><?php $wpo_wcpdf->custom_field(‘_billing_address_1’); ?</h3>
    <h3><?php $wpo_wcpdf->custom_field(‘_billing_address_2’); ?></h3>
    <h3><?php $wpo_wcpdf->custom_field(‘_billing_postcode’); ?> <?php $wpo_wcpdf->custom_field(‘_billing_city’); ?></h3>

    The custom field (‘_billing_civilite’) appears well but not the others.

    Thank you for your help.

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

    (@pomegranate)

    Hi! This is related to the WooCommerce 3.0 update, ‘_billing_address_1’ etc are no longer regarded as custom fields in WC3.0/3.1 but as core ‘order properties’.
    You can get them with special ‘getters’, like get_billing_postcode().
    The following code should work with 3.0+:

    
    <h3><?php $wpo_wcpdf->custom_field('_billing_civilite'); ?> <?php echo $this->order->get_formatted_billing_full_name(); ?></h3>
    <h3><?php echo $this->order->get_billing_address_1(); ?></h3>
    <h3><?php echo $this->order->get_billing_address_2(); ?></h3>
    <h3><?php echo $this->order->get_billing_postcode(); ?> <?php echo $this->order->get_billing_city(); ?></h3>
    

    Note the use of get_formatted_billing_full_name() – you can also use get_billing_first_name() and get_billing_last_name() separately if you want.

    Hope that helps!
    Ewout

    Thread Starter fgauttron

    (@fgauttron)

    Thank you for you help. It works.

    Thread Starter fgauttron

    (@fgauttron)

    Thank you for your help. It works.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custome template does not work after the last update’ is closed to new replies.