wc_delete_order_item_meta

WooCommerce Order Item Meta API - Delete term meta.

Description

wc_delete_order_item_meta( (mixed) $item_id, (mixed) $meta_key, (string) $meta_value = '', (bool) $delete_all = false ); 

Parameters (4)

0. $item_id (mixed)
The item id.
1. $meta_key (mixed)
The meta key.
2. $meta_value — Optional. (string) => ''
The meta value.
3. $delete_all — Optional. (bool) => false
(default: false)

Usage

  1. if ( !function_exists( 'wc_delete_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 meta key. 
  8. $meta_key = null; 
  9.  
  10. // The meta value. 
  11. $meta_value = ''; 
  12.  
  13. // (default: false) 
  14. $delete_all = false; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = wc_delete_order_item_meta($item_id, $meta_key, $meta_value, $delete_all); 
  18.  

Defined (1)

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

/includes/wc-order-item-functions.php  
  1. function wc_delete_order_item_meta( $item_id, $meta_key, $meta_value = '', $delete_all = false ) { 
  2. $data_store = WC_Data_Store::load( 'order-item' ); 
  3. if ( $data_store->delete_metadata( $item_id, $meta_key, $meta_value, $delete_all ) ) { 
  4. $cache_key = WC_Cache_Helper::get_cache_prefix( 'order-items' ) . 'object_meta_' . $item_id; 
  5. wp_cache_delete( $cache_key, 'order-items' ); 
  6. return true; 
  7. return false;