• Resolved yaang1

    (@yaang1)


    Hello and thank you for a very nice plugin.

    My question is;
    I am currently using a plugin named WooCommerce Print Invoice & Delivery Note for invoices. To that, ive extended the information with another plugin named Delivery Time Picker for Shipping to customize the date you would want it delivered. The date you pick I would like to appear on my invoice. How is that possible?

    In the confirmation e-mail it would be very nice if it could be displayed.

    I´ve noticed a post a year ago with a similar problem, that solved it by hardcoding this snippet into template.php:

    <?php $delivery_date_label = get_option(‘orddd_delivery_date_field_label’); if ($order->order_custom_fields[$delivery_date_label][0] != ”) { ?> <div> <h3><?php _e(‘Delivery Date’, ‘woocommerce-pip’); ?></h3> <?php echo $order->order_custom_fields[$delivery_date_label][0]; ?> </div> <?php } ?>

    Best regards,

    Dan Christensen

    https://wordpress.org/plugins/woocommerce-delivery-notes/

Viewing 1 replies (of 1 total)
  • Hi, thanks for your question. It is already answered in the FAQ!

    http://wordpress.org/plugins/woocommerce-delivery-notes/faq/

    How can I add some more fields to the order info section?

    Use the wcdn_order_info_fields filter hook. It returns all the fields as array. Read the WooCommerce documentation to learn how you get custom checkout and order fields.

    Important: To get custom meta field values you will most probably need the get_post_meta( $order->id, ‘your_meta_field_name’, true); function and of course the your_meta_field_name.

    An example that adds a ‘Delivery Time’ field to the end of the list. Paste the code in the functions.php file of your theme. Don’t forget to replace your_meta_field_name with your field name:

    function my_custom_order_fields( $fields, $order ) {
        $new_fields = array();
    
        if( get_post_meta( $order->id, 'your_meta_field_name', true ) ) {
            $new_fields['your_meta_field_name'] = array(
                'label' => 'Delivery Time',
                'value' => get_post_meta( $order->id, 'your_meta_field_name', true )
            );
        }
    
        return array_merge( $fields, $new_fields );
    }
    add_filter( 'wcdn_order_info_fields', 'my_custom_order_fields', 10, 2 );
Viewing 1 replies (of 1 total)
  • The topic ‘Display Delivery Time on Invoice’ is closed to new replies.