php - Woocommerce How to get Order item meta in client side -


based on order id how order item meta? used product add-ons plugin sending item meta data client side exact order item data need display on client side:

screenshot

$order = new wc_order($order_id); $customer = new wc_customer( $order_id ); 

based on order id need retrieve order item meta client side.

you can if use woocommerce hook called woocommerce_after_order_itemmeta.

i create custom example function show how work, if need more see link

add_action( 'woocommerce_after_order_itemmeta', 'lt_order_meta_customized_display',10, 3 );  /**  * @param $item_id  * @param $item  * @param $product   product  */ function lt_order_meta_customized_display( $item_id, $item, $product ) {     /*     *  default key "$all_meta_data" can be: _qty,_tax_class,_line_tax,_line_tax_data,_variation_id,_product_id,_line_subtotal, _line_total,_line_subtotal_tax     */     $all_meta_data = get_metadata( 'order_item', $item_id, "", "" );       ?>     <div class="order_data_column" style="float: left; width: 50%; padding: 0 5px;">         <h4><?php _e( 'customized values' ); ?></h4>         <?php             echo '<p><span style="display:inline-block; width:100px;">' . __( "item show 01" ) . '</span><span>:&nbsp;' . "value show 01" . '</span></p>';     ?>      </div> <?php } 

the visual result similar to:

enter image description here


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -