/** * @param EntityInterface $object */ private function recalculateTax(EntityInterface $object) { /** @var Order $order */ $order = new Order(array()); $order = $this->factory->fill($order, $object->getStateToSave()); $object->setTaxDefinitions($order->getTaxDefinitions()); }
/** * Find and fetches saved cart. * If cart is not found - returns new empty one. * * @param $id string Id of cart to fetch. * * @return \Jigoshop\Entity\Cart Prepared cart instance. */ public function get($id) { if (!isset($this->carts[$id])) { $cart = new Cart($this->options->get('tax.classes')); $cart->setCustomer($this->customerService->getCurrent()); $cart->getCustomer()->selectTaxAddress($this->options->get('taxes.shipping') ? 'shipping' : 'billing'); // Fetch data from session if available $cart->setId($id); $state = $this->getStateFromSession($id); if (isset($_POST['jigoshop_order']) && Pages::isCheckout()) { $state = $this->getStateFromCheckout($state); } // TODO: Support for transients? $cart = $this->orderFactory->fill($cart, $state); $this->carts[$id] = $this->wp->applyFilters('jigoshop\\service\\cart\\get', $cart, $state); } return $this->carts[$id]; }