woocommerce_add_order_item_meta

The WooCommerce woocommerce add order item meta function.

Description

woocommerce_add_order_item_meta( $item_id, $meta_key, $meta_value, (bool) $unique = false ); 

Parameters (4)

0. $item_id
The item id.
1. $meta_key
The meta key.
2. $meta_value
The meta value.
3. $unique — Optional. (bool) => false
The unique.

Usage

  1. if ( !function_exists( 'woocommerce_add_order_item_meta' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-deprecated-functions.php'; 
  3.  
  4. // The item id. 
  5. $item_id = null; 
  6.  
  7. // The meta key. 
  8. $meta_key = null; 
  9.  
  10. // The meta value. 
  11. $meta_value = null; 
  12.  
  13. // The unique. 
  14. $unique = false; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = woocommerce_add_order_item_meta($item_id, $meta_key, $meta_value, $unique); 
  18.  

Defined (1)

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

/includes/wc-deprecated-functions.php  
  1. function woocommerce_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique = false ) { 
  2. wc_deprecated_function( __FUNCTION__, '3.0', 'wc_add_order_item_meta' ); 
  3. return wc_add_order_item_meta( $item_id, $meta_key, $meta_value, $unique );