WC_Abstract_Order::remove_order_items()publicWC 1.0

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

Метод класса: WC_Abstract_Order{}

Возвращает

null. Ничего (null).

Использование

$WC_Abstract_Order = new WC_Abstract_Order();
$WC_Abstract_Order->remove_order_items( $type );
$type(строка)
Order item type.
По умолчанию: null

Код WC_Abstract_Order::remove_order_items() WC 8.7.0

public function remove_order_items( $type = null ) {

	/**
	 * Trigger action before removing all order line items. Allows you to track order items.
	 *
	 * @param  WC_Order  $this  The current order object.
	 * @param  string $type Order item type. Default null.
	 *
	 * @since 7.8.0
	 */
	do_action( 'woocommerce_remove_order_items', $this, $type );
	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();
	}
	/**
	 * Trigger action after removing all order line items.
	 *
	 * @param  WC_Order  $this  The current order object.
	 * @param  string $type Order item type. Default null.
	 *
	 * @since 7.8.0
	 */
	do_action( 'woocommerce_removed_order_items', $this, $type );
}