WC_Abstract_Order::remove_order_items( string $type = null )

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


Description Description


Parameters Parameters

$type

(Optional) Order item type.

Default value: null


Top ↑

Source Source

File: includes/abstracts/abstract-wc-order.php

	public function remove_order_items( $type = null ) {
		if ( ! empty( $type ) ) {
			$this->data_store->delete_items( $this, $type );

			$group = $this->type_to_group( $type );

			if ( $group ) {
				unset( $this->items[ $group ] );
			}
		} else {
			$this->data_store->delete_items( $this );
			$this->items = array();
		}
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.