You are here

public function Shipment::removeItem in Commerce Shipping 8.2

Removes a shipment item.

Parameters

\Drupal\commerce_shipping\ShipmentItem $shipment_item: The shipment item.

Return value

$this

Overrides ShipmentInterface::removeItem

File

src/Entity/Shipment.php, line 279

Class

Shipment
Defines the shipment entity class.

Namespace

Drupal\commerce_shipping\Entity

Code

public function removeItem(ShipmentItem $shipment_item) {
  $this
    ->get('items')
    ->removeShipmentItem($shipment_item);
  $this
    ->recalculateWeight();
  return $this;
}