WordPress at Your Fingertips
function is not described

Abstract_WC_Order_Item_Type_Data_Store::delete() public WC 3.0.0

Remove an order item from the database.

{} It's a method of the class: Abstract_WC_Order_Item_Type_Data_Store{}

Return

null. Nothing.

Usage

$Abstract_WC_Order_Item_Type_Data_Store = new Abstract_WC_Order_Item_Type_Data_Store();
$Abstract_WC_Order_Item_Type_Data_Store->delete( $item, $args );
$item(WC_Order_Item) (required) (passed by reference — &)
Order item object.
$args(array)
Array of args to pass to the delete method.
Default: array()

Changelog

Since 3.0.0 Introduced.

Code of Abstract_WC_Order_Item_Type_Data_Store::delete() WC 5.8.0

public function delete( &$item, $args = array() ) {
	if ( $item->get_id() ) {
		global $wpdb;
		do_action( 'woocommerce_before_delete_order_item', $item->get_id() );
		$wpdb->delete( $wpdb->prefix . 'woocommerce_order_items', array( 'order_item_id' => $item->get_id() ) );
		$wpdb->delete( $wpdb->prefix . 'woocommerce_order_itemmeta', array( 'order_item_id' => $item->get_id() ) );
		do_action( 'woocommerce_delete_order_item', $item->get_id() );
		$this->clear_cache( $item );
	}
}