• Resolved Daniel Godoi Wagner

    (@dannwagner)


    THANKS A LOR FOR HELPING!

    Hi there! Needing some help again! My cliente need to obligate the customer to inform what kind oh card he needs to pay with (its 3 options); It is already at the site, but is not working (the data are note being printed at the PRINT INVOICE) – I tried to adapt a function as bellow, knowing the name of the field, just like that. Also a print of the form and the PRINT INVOICE where I want to show the extra field: https://telecris.app/wp-content/uploads/2024/06/print-invoice.png

    function example_custom_order_fields22( $fields, $order ) {
    $new_fields = array();

    if( get_post_meta( $order->id, 'billing_wooccm12', true ) ) {
    $new_fields['billing_wooccm12'] = array(
    'label' => 'ID:',
    'value' => get_post_meta( $order->id, 'billing_wooccm12', true )
    );
    }

    return array_merge( $fields, $new_fields );

    }
    add_filter( 'wcdn_order_info_fields', 'example_custom_order_fields22', 10, 2 );

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @dannwagner,

    I am sharing with you the modified filter. Please use this filter and let us know the result.

    function custom_order_info_fields( $fields, $order ) {
    // echo '<pre>'; print_r( $order ); echo '</pre>';
    // Add your custom meta fields here
    $custom_fields = array(
    array(
    'label' => 'ID:',
    'value' => $order->get_meta('billing_wooccm12', true),
    ),
    );

    // Merge the custom fields with the existing fields
    $fields = array_merge( $fields, $custom_fields );
    return $fields;
    }
    add_filter( 'wcdn_order_info_fields', 'custom_order_info_fields', 10, 2 );

    If this does not work, then you need to confirm whether the field you are trying to add is present in the order or not.

    For debugging purposes, you can uncomment the line echo ”; print_r( $order ); echo ”; and check the order data in the invoice.

    Regards,
    Nikhil.

    Thread Starter Daniel Godoi Wagner

    (@dannwagner)

    Hi there! Thanks fot the code!

    The filed data is not been put at the print invoice. Maybe the filed ID insnt right, I don’t know. But the data is being collected, already checked. https://telecris.app/check-out-finalizacao-pedido/

    Can you help me please?

    Hi @dannwagner ,

    Please guide us on how to add the option “SELECT CARD (PAY ON DELIVERY)” on the checkout page.

    If you done this using any custom code or plugin then please share the details. If it is a free plugin, then we can check and let you know the outcomes.

    Regards,
    Nikhil.

    Thread Starter Daniel Godoi Wagner

    (@dannwagner)

    Hi there, friends! The plugin that I use is called WooCommerce Checkout Manager by quadlayers. And the field is a radio button type. Thanks a lot again!

    Hi @dannwagner

    Thank you for providing the details.

    You can check this https://prnt.sc/mi6alzECbWb4 ID in your WooCommerce Checkout Manager plugin settings and use it as a meta value in the modified filter code which I provided. in your case use this key- _billing_wooccm12
    I have verified this on my local site, and the code and filter are working properly.

    Please let us know the result.

    Regards,
    Nikhil.

    • This reply was modified 5 months, 1 week ago by nick1122.
    • This reply was modified 5 months, 1 week ago by nick1122.
    Thread Starter Daniel Godoi Wagner

    (@dannwagner)

    Man it worked fine! There was just faulting an underline at the front… Now its all fine! Thanks a lot!

    Plugin Author priyankajagtap

    (@priyankajagtap)

    Hi @dannwagner,

    That’s great. It is nice to know that it worked fine for you. ??

    Do let us know if you have any further queries.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.