Okay
  Public Ticket #2683092
Customize Order detail in Admin
Closed

Comments

  •  6
    Set Veasna started the conversation

    Dear support team,

    I am sorry this maybe out of topic but I cannot find solution for weeks

    So I would like to ask you maybe you can help.

    In the admin Order detail page:

    I want to add some text next to product title. How to do that? (please see my attach file)


    Best regards,

    Set Veasna

  •  2,131
    WebWizards replied

    Hi Set,

    No problem, I am happy to help if I can. But I am not sure if I understand.


    1 possibility is: You could just edit the product title in WooCommerce->Products->Edit


    Or how do you want this to work? what exactly do you need to accomplish? Or do you need to add some comments to the order?

    You can add comments here:

    5019602937.png



    Kind Regards,

    Stefan

  •  6
    Set Veasna replied

    Thank you very much for your help.

    In my site in order detail in admin page I want to display automatically UOM next to product title or product price.

    now I am using this plugin: WooCommerce Unit Of Measure. this plugin is good. However, this plug in help only display Unit of Measure at front-end only while in wp-admin->order details did not display any UOM.

    So what I want is, when I set to any product with UOM, thus in order detail page(in admin) should auto display UOM next to price/product name.

    Best regards,

    Set Veasna



  •  2,131
    WebWizards replied

    I looked through the code and wrote this snippet:

    add_action('woocommerce_after_order_itemmeta', function($item_id){
                global $post;
                $order_id = $post->ID;
                $order = wc_get_order( $order_id );
                $items = $order->get_items();
                foreach ( $items as $item ) {
                    if ($item->get_id() === $item_id){
                        // get product id
                        $product_id = $item->get_product_id();
                    }
                }
                $woo_uom_output = get_post_meta( $product_id, '_woo_uom_input', true );
                // Check if variable OR UOM text exists.
                if ( $woo_uom_output ) {
                    echo 'Unit: '.$woo_uom_output;
                }
            });

    Effect of the snippet:

    6148256303.png


    You can see it says "Unit: ... "


    See this article for how to add snippets:

    https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/


    Kind Regards,

    Stefan

  •  6
    Set Veasna replied

    Thank you very much for your help.

    I really appreciate your help.

    Best regards,

    Set Veasna

  •  6
    Set Veasna replied

    Thank you very much again

    now my order details page display Unit of Measurement very nice But on printing invoice not display that UOM.

    when printing the invoice it display only product title.

    Can we also display UOM on the printing invoice as well?

    now I am using plugin: woocommerce pdf invoice

    Best regards,

    Set Veasna

  •  6
    Set Veasna replied

    Dear support team,

    I found solution already for my previous question (how to add Unit of Measure to printing invoice)

    I found solution to my question already.


    Thank you.

    Veasna



  •   WebWizards replied privately