WC_Order_Item_Data_Store::add_metadata()
Add term meta.
Method of the class: WC_Order_Item_Data_Store{}
No Hooks.
Return
Int
. New row ID or 0
Usage
$WC_Order_Item_Data_Store = new WC_Order_Item_Data_Store(); $WC_Order_Item_Data_Store->add_metadata( $item_id, $meta_key, $meta_value, $unique );
- $item_id(int) (required)
- Item ID.
- $meta_key(string) (required)
- Meta key.
- $meta_value(mixed) (required)
- Meta value.
- $unique(true|false)
- -
Default: false)
Changelog
Since 3.0.0 | Introduced. |
WC_Order_Item_Data_Store::add_metadata() WC Order Item Data Store::add metadata code WC 9.4.2
public function add_metadata( $item_id, $meta_key, $meta_value, $unique = false ) { return add_metadata( 'order_item', $item_id, wp_slash( $meta_key ), is_string( $meta_value ) ? wp_slash( $meta_value ) : $meta_value, $unique ); }