public function Order::getTotal in Ubercart 8.4
Returns the order total amount (including all line items).
Return value
float The order total.
Overrides OrderInterface::getTotal
1 call to Order::getTotal()
- Order::preSave in uc_order/
src/ Entity/ Order.php - Acts on an entity before the presave hook is invoked.
File
- uc_order/
src/ Entity/ Order.php, line 380
Class
- Order
- Defines the order entity class.
Namespace
Drupal\uc_order\EntityCode
public function getTotal() {
$total = $this
->getSubtotal();
$definitions = \Drupal::service('plugin.manager.uc_order.line_item')
->getDefinitions();
foreach ($this->line_items as $item) {
if (!empty($definitions[$item['type']]['calculated'])) {
$total += $item['amount'];
}
}
return $total;
}