Conditional Custom Field
-
Hi,
I want to return a custom field in my packing slip only if the field has a value. The following code is not working though? What am I doing wrong?add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_delivery_date', 10, 2 ); function wpo_wcpdf_delivery_date ($template_type, $order) { if ($template_type == 'packing-slip') { $document = wcpdf_get_document( $template_type, $order ); if (!empty($document->custom_field('Delivery Time'))) { ?> <tr class="delivery-date"> <th><?php echo __('Delivery Time','domain').": "; ?></th> <td><?php $document->custom_field('Delivery Time'); ?></td> </tr> <?php } } }
Thank you very much.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Conditional Custom Field’ is closed to new replies.