/** * Gets the total amount to be paid for the items in the cart, including taxes and other modifiers * @access public * @return float */ public function recalculate_all_cart_totals() { $pre_tax_total = $this->get_cart_total_before_tax(); $taxes_total = EEH_Line_Item::ensure_taxes_applied($this->_grand_total); $this->_grand_total->set_total($pre_tax_total + $taxes_total); $this->_grand_total->save_this_and_descendants_to_txn(); return $this->get_grand_total()->total(); }
/** * Updates the line item and its children's quantities to the specified number. * Does NOT save them or recalculate totals. * @param EE_Line_Item $line_item * @param int $new_quantity */ public static function update_quantity(EE_Line_Item $line_item, $new_quantity) { if (!$line_item->is_percent()) { $line_item->set_quantity($new_quantity); $line_item->set_total($line_item->unit_price() * $new_quantity); } foreach ($line_item->children() as $child) { if ($child->is_sub_line_item()) { EEH_Line_Item::update_quantity($child, $new_quantity); } } }