You are here

public function OrderItem::setQuantity in Commerce Core 8.2

Sets the order item quantity.

Parameters

string $quantity: The order item quantity.

Return value

$this

Overrides OrderItemInterface::setQuantity

File

modules/order/src/Entity/OrderItem.php, line 113

Class

OrderItem
Defines the order item entity class.

Namespace

Drupal\commerce_order\Entity

Code

public function setQuantity($quantity) {
  $this
    ->set('quantity', (string) $quantity);
  $this
    ->recalculateTotalPrice();
  return $this;
}