• Resolved koupmi

    (@koupmi)


    I tried this code:

    //invoice
    
    add_action( 'wpo_wcpdf_after_item_meta', 'wpo_wcpdf_product_custom_field', 10, 3 );
    function wpo_wcpdf_product_custom_field ( $template_type, $item, $order ) {
        // check if product exists first
        if (empty($item['product'])) return;
      
        // replace 'Location' with your custom field name!
        $field_name = 'order_jmeno_ucastnika1';
        $location = $item['product']->get_meta($field_name,true,'edit');
        if (!empty($location)) {
            echo '<div class="product-location">Location: '.$location.'</div>';
        }
    }
    

    Also this code:

    add_action( 'wpo_wcpdf_after_order_data', 'wpo_wcpdf_my_custom_field', 10, 2 );
    function wpo_wcpdf_my_custom_field ($template_type, $order) {
        if ($template_type == 'invoice') {
            ?>
            <tr class="order_jmeno_ucastnika1">
            <th>Custom Field:</th>
            <td><?php echo $order->get_meta('order_jmeno_ucastnika1'); ?></td>
            </tr>
            <?php
        }
    }

    But nothing showed. I have also PRO version of plugin. I need show this field in invoice with condition, when is in order virtual product.

    It can be displayed under product in invoice, but also under billing informations.

    • This topic was modified 1 year, 7 months ago by koupmi.
    • This topic was modified 1 year, 7 months ago by koupmi.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom meta field doesnt showing’ is closed to new replies.