• Resolved cat199567

    (@cat199567)


    I have a custom field with a meta_key: “event_type”

    I would like to add this to the order details page.

    I have found the .php file but am unable to add the additional details.

    Please can you assist me with the code or point me in the right direction

    Many Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello @cat199567,

    In order to add a custom field on the order details page, you will need modification on the file included in the folder. :/wp-content/plugins/dokan-lite/templates/orders/

    Specifically for the order details page the file is : dokan-lite/templates/orders/details.php

    I hope this helps ??

    Thread Starter cat199567

    (@cat199567)

    Hi Roshni, hope you are well!

    I have the following code which works outside of Dokan but will not work on the Dokan order page.

    I have tried adding it to the file you have mentioned but get a critical error.

    Could you assist me with where I am going wrong please.

    <td class="event-type"><?php echo esc_html($booking->get_order()->get_meta( 'type_of_event' ));?></td>

    I tried to do this. It works well
    Can display the details as you wish
    I don’t know the name of the hook.
    Please tell me

    			
    <span><?php esc_html_e( 'NameField:', 'dokan-lite' ); ?> </span> <?php echo $order->get_meta( '_youField' ); ?>
    
    
    • This reply was modified 4 years, 10 months ago by thanidoudto.
    Thread Starter cat199567

    (@cat199567)

    Thank you! It worked perfectly!

    Hello
    I’ve found a way to get hooks into General Details.
    Hope to help you a lot

    function dokan_order_details_after_customer ( $order ) {
    
         echo '<p><strong style="color:red">'.__('NameField').':</strong> ' . $order->get_meta( '_Field' ) . '</p>';
    }
    add_action( 'dokan_order_details_after_customer_info', 'dokan_order_details_after_customer' );
    • This reply was modified 4 years, 10 months ago by thanidoudto.
    Thread Starter cat199567

    (@cat199567)

    Hi There,

    Thank you the piece of code!

    Just wanted to enquire – what is this code used for and where would I place it. Just wanted to say that the code you provided me with further above has worked perfectly!

    Hi guys.
    I am trying to achive a similar goal as discussed above. I have some custom fields on my billing details which i want to show in my vendor dashboard – > Orders.

    Please help me customize on this regard.

    THanks.

    Thread Starter cat199567

    (@cat199567)

    Hi There,

    I have got it working using the following code:

    File Location: Dokan-Lite / Templates / Orders / details.php

    I created another “div” and added in the following code:

    <div class="" style="dokan-left dokan-order-shipping-address">
                    <div class="dokan-panel dokan-panel-default">
                        <div class="dokan-panel-heading"><strong><?php esc_html_e( 'Section Name', 'dokan-lite' ); ?></strong></div>
                        <div class="dokan-panel-body">
                          
                       <li><span><?php esc_html_e( 'Custom Field Name 1:', 'dokan-lite' ); ?> </span> <?php echo $order->get_meta( 'custom_field_meta_key_1' ); ?></li>
                       <li><span><?php esc_html_e( 'Custom Field Name 2:', 'dokan-lite' ); ?> </span> <?php echo $order->get_meta( 'custom_field_meta_key_2' ); ?> </li>
    
                     
                          
                        </div>
                    </div>
                </div>

    Hope that helps!

    • This reply was modified 4 years, 6 months ago by cat199567.
    • This reply was modified 4 years, 6 months ago by cat199567.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Add Custom Field to Order Details’ is closed to new replies.