You are here

public function Order::getSubtotal in Ubercart 8.4

Returns the order subtotal amount (products only).

Return value

float The order subtotal.

Overrides OrderInterface::getSubtotal

1 call to Order::getSubtotal()
Order::getTotal in uc_order/src/Entity/Order.php
Returns the order total amount (including all line items).

File

uc_order/src/Entity/Order.php, line 369

Class

Order
Defines the order entity class.

Namespace

Drupal\uc_order\Entity

Code

public function getSubtotal() {
  $subtotal = 0;
  foreach ($this->products as $product) {
    $subtotal += $product->price->value * $product->qty->value;
  }
  return $subtotal;
}