WordPress at Your Fingertips
function is not described

Abstract_WC_Order_Data_Store_CPT::delete_items() public WC 1.0

Remove all line items (products, coupons, shipping, taxes) from the order.

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

No Hooks.

Return

null. Nothing.

Usage

$Abstract_WC_Order_Data_Store_CPT = new Abstract_WC_Order_Data_Store_CPT();
$Abstract_WC_Order_Data_Store_CPT->delete_items( $order, $type );
$order(WC_Order) (required)
Order object.
$type(string)
Order item type.
Default: null

Code of Abstract_WC_Order_Data_Store_CPT::delete_items() WC 5.8.0

public function delete_items( $order, $type = null ) {
	global $wpdb;
	if ( ! empty( $type ) ) {
		$wpdb->query( $wpdb->prepare( "DELETE FROM itemmeta USING {$wpdb->prefix}woocommerce_order_itemmeta itemmeta INNER JOIN {$wpdb->prefix}woocommerce_order_items items WHERE itemmeta.order_item_id = items.order_item_id AND items.order_id = %d AND items.order_item_type = %s", $order->get_id(), $type ) );
		$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_order_items WHERE order_id = %d AND order_item_type = %s", $order->get_id(), $type ) );
	} else {
		$wpdb->query( $wpdb->prepare( "DELETE FROM itemmeta USING {$wpdb->prefix}woocommerce_order_itemmeta itemmeta INNER JOIN {$wpdb->prefix}woocommerce_order_items items WHERE itemmeta.order_item_id = items.order_item_id and items.order_id = %d", $order->get_id() ) );
		$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_order_items WHERE order_id = %d", $order->get_id() ) );
	}
	$this->clear_caches( $order );
}