If statement custom field
-
Hi,
I have created 2 custom fields which are included in the invoice. But the fields are not required so when a customer does not fill in the field it should not be visible on the invoice but it is.
Here is the code.
add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_delivery_date', 10, 2 ); function wpo_wcpdf_delivery_date ($template_type, $order) { $document = wcpdf_get_document( $template_type, $order ); if ($template_type == 'invoice') { ?> <tr class="delivery-date"> <th>KvK nummer</th> <td><?php $document->custom_field('billing_kvk'); ?></td> </tr> <tr class="delivery-date"> <th>BTW nummer</th> <td><?php $document->custom_field('billing_btw'); ?></td> </tr> <tr class="delivery-date"> <th>Inkooporder</th> <td><?php $document->custom_field('billing_inkooporder'); ?></td> </tr> <?php }
How can I make a if statement like when field
billing_btw
is empty dont show the<tr class="delivery-date">
?Thanks for your time!
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘If statement custom field’ is closed to new replies.