Support » Plugin: WooCommerce PDF Invoices & Packing Slips » Not showing custom fields in Invoice

  • Resolved Kaizur Ahmed

    (@kaizur-ahmed)


    Hi,
    I created a custom template. That’s working fine. I wrote <?php echo $this->custom_field(‘_order_key’); ?>. And displayed ‘order key’ value in invoice template. But, when I wrote <?php $this->custom_field(‘my_custom_fieldname’); ?>, then not displayed this value.

    Note: Custom field is a default custom field. And I tried via ACF also. But, could not come out success. I also tried via simple(default) template.

    WP version: 5.0.2
    Woocommerce version: 3.5.3
    WooCommerce PDF Invoices & Packing Slips version: 2.2.5

    • This topic was modified 1 year, 5 months ago by Kaizur Ahmed.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ewout

    (@pomegranate)

    Hello Kaizur,
    I’m sorry to hear it’s not working for you. You write ‘Custom field is a default custom field.’, what do you mean by that? Is it possible that you simply need an underscore for the custom field? _my_custom_fieldname?
    If you’re not sure of the name of the custom field, we have a guide in our documentation: Finding WooCommerce Custom Fields

    Let us know what you find and we’ll do our best to help!

    Custom field is a default custom field. means WordPress default custom field option.
    Anyway, I want to show a value from custom field for each product. And you know “_my_custom_fieldname” is a hidden field. So, it is not possible to create _my_custom_fieldname and set individual value for each product by WP default option. That’s why I used ACF and create a _my_custom_fieldname with underscore(prefix). But, not showing this value in invoice.

    Thanks.

    • This reply was modified 1 year, 5 months ago by Kaizur Ahmed.
    Plugin Author Ewout

    (@pomegranate)

    Ah I see, this is not about custom fields in the order but custom fields in the product! THese are not the same. An order can have multiple products so WordPress wouldn’t know which product you want to target. If you want to show custom fields from products you need to do this in the order items table. More information: Displaying product custom fields

    @ewout, It’s working. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Not showing custom fields in Invoice’ is closed to new replies.