• Resolved victorfpaula

    (@victorfpaula)


    Hello, maybe you can help me …
    I am using the “WooCommerce Custom Payment Gateway Pro” plugin for details on the payment method.
    But the details added in “custom fields” do not appear in my template … I installed the tool kits, and I identified the fields that I need to show in the pdf …
    (_payment_method_title) and (woocommerce_customized_payment_data)

    is there any action I can enter in these two custom information generated by “WooCommerce Custom Payment Gateway Pro”?

    Thank you for your help!

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

    (@pomegranate)

    Hello Victor,
    The _payment_method_title field is a core WooCommerce Order Property that is normally already displayed in the invoice (source):

    
    <?php $this->payment_method(); ?>
    

    If you want to call this separately somewhere else, you could retrieve it with:

    
    $payment_method = $order->get_payment_method_title();
    

    or display it directly:

    
    echo $order->get_payment_method_title();
    

    For the woocommerce_customized_payment_data, it depends on the contents of this field. The _data suffix makes me suspect that it may be an array with information rather than a flat piece of text (string).

    If it’s just a string you can follow the documentation: Displaying a custom field

    Otherwise I recommend contacting the developers of the WooCommerce Custom Payment Gateway Pro plugin to ask for the best way to include the data (you can mention our action hooks reference)

    Hope that helps!

    Thread Starter victorfpaula

    (@victorfpaula)

    in fact, later I noticed that the toolkits shows the following information:
    woocommerce_customized_payment_data
    »I switch to:

    is exactly the answer that appears in the field “I change to:” that I need to show in my pdf.

    I tried using the code

    add_action ('wpo_wcpdf_after_order_data', 'wpo_wcpdf_woocommerce_customized_payment_data', 10, 2);
    function wpo_wcpdf_woocommerce_customized_payment_data ($ template_type, $ order) {
    if ($ template_type == 'packing-slip') {
    ?>
    <tr class = "troco">
    <th> troco: </ th>
    <td> <? php echo $ order-> get_meta ('troco'); ?> </ td>
    </ tr>
    <? php
    }
    }

    but it did not work
    I tried contacting the plugin support, but I could not get a return, I’m desperate! LOL

    thanksssss

    • This reply was modified 5 years, 1 month ago by victorfpaula.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add Custom Fields – PDF for Thermal Print’ is closed to new replies.