wc_get_order_item_meta

WooCommerce Order Item Meta API - Get term meta.

Description

wc_get_order_item_meta( (mixed) $item_id, (mixed) $key, (bool) $single = true ); 

Parameters (3)

0. $item_id (mixed)
The item id.
1. $key (mixed)
The key.
2. $single — Optional. (bool) => true
(default: true)

Usage

  1. if ( !function_exists( 'wc_get_order_item_meta' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-order-item-functions.php'; 
  3.  
  4. // The item id. 
  5. $item_id = null; 
  6.  
  7. // The key. 
  8. $key = null; 
  9.  
  10. // (default: true) 
  11. $single = true; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = wc_get_order_item_meta($item_id, $key, $single); 
  15.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-order-item-functions.php  
  1. function wc_get_order_item_meta( $item_id, $key, $single = true ) { 
  2. $data_store = WC_Data_Store::load( 'order-item' ); 
  3. return $data_store->get_metadata( $item_id, $key, $single );