Returns a total volume of all products in the order
@param array $order
@param array $cart
@return float|null
4309
public function getVolume(array $order, array &$cart)
    {
        $result = null;
        $this->hook->attach('order.volume.get.before', $order, $cart, $result, $this);

        if (isset($result)) {
            return (float) $result;
        }

        $total = 0.0;

        foreach ($cart['items'] as &$item) {
            $this->sumTotalVolume($total, $item, $order);
        }

        $result = round($total, 2);
        $this->hook->attach('order.volume.get.after', $order, $cart, $result, $this);
        return (float) $result;
    }
87083
public function has_shipping( $order ) {
		$virtual = true;
		foreach ( $this->get_all_products_in( $order ) as $product ) {
			/* @var \WC_Product $product */
			if ( ! $product->is_virtual() ) {
				$virtual = false;
				break;
			}
		}
		return ! $virtual;
	}
446276
public function total()
    {
        return (float) array_sum(
            array_map(function (CartItem $item) {
                return $item->getTotalPrice();
            }, $this->items)
        );
    }
1296690
private function storeOrderItems($order, $data)
    {
        $cart = isset($data['num_cart_items']);
        $numItems = (isset($data['num_cart_items'])) ? $data['num_cart_items'] : 1;

        for ($i = 0; $i < $numItems; $i++) {

            $suffix = ($numItems > 1 || $cart) ? ($i + 1) : '';
            $suffixUnderscore = ($numItems > 1 || $cart) ? '_' . $suffix : $suffix;

            $item = new IpnOrderItem();
            if (isset($data['item_name' . $suffix]))
                $item->item_name = $data['item_name' . $suffix];
            if (isset($data['item_number' . $suffix]))
                $item->item_number = $data['item_number' . $suffix];
            if (isset($data['quantity' . $suffix]))
                $item->quantity = $data['quantity' . $suffix];
            if (isset($data['mc_gross' . $suffixUnderscore]))
                $item->mc_gross = $data['mc_gross' . $suffixUnderscore];
            if (isset($data['mc_handling' . $suffix]))
                $item->mc_handling = $data['mc_handling' . $suffix];
            if (isset($data['mc_shipping' . $suffix]))
                $item->mc_shipping = $data['mc_shipping' . $suffix];
            if (isset($data['tax' . $suffix]))
                $item->tax = $data['tax' . $suffix];

            $order->items()->save($item);

            // Set the order item options if any
            // $count = 7 because PayPal allows you to set a maximum of 7 options per item
            // Reference: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables
            for ($ii = 1, $count = 7; $ii < $count; $ii++) {
                if (isset($data['option_name' . $ii . '_' . $suffix])) {
                    $option = new IpnOrderItemOption();
                    $option->option_name = $data['option_name' . $ii . '_' . $suffix];
                    if (isset($data['option_selection' . $ii . '_' . $suffix])) {
                        $option->option_selection = $data['option_selection' . $ii . '_' . $suffix];
                    }
                    $item->options()->save($option);
                }
            }
        }
    }
1182713
public function getTotalHubFeeForOrder(\HarvestCloud\CoreBundle\Entity\Order $order)
    {
        return ($order->getLineItemTotal() * $this->getSellerHubRef()->getVariableFee() / 100) + $this->getSellerHubRef()->getFixedFee();
    }
409032
public function createFromCartItem( $order, $cartItem, $config = [] ) {

		$model	= $this->getModelObject();

		// Set Attributes
		$model->orderId		= $order->id;
		$model->createdBy	= $order->creator->id;

		// Copy from Cart Item
		$model->copyForUpdateFrom( $cartItem, [ 'primaryUnitId', 'purchasingUnitId', 'quantityUnitId', 'weightUnitId', 'volumeUnitId', 'lengthUnitId', 'parentId', 'parentType', 'name', 'price', 'primary', 'purchase', 'quantity', 'total', 'weight', 'volume', 'length', 'width', 'height', 'radius' ] );

		$model->save();

		// Return OrderItem
		return $model;
	}
249699
protected function createItemBagForOrder(Order $order)
    {
        if (!$this->sendCartInfo) {
            return null;
        }

        $items = $this->getItemListForOrder($order);
        $itemBagClassName = $this->getItemBagClassName();

        return new $itemBagClassName($items);
    }
1243154
public function getFileErrors($order = 'error.counter', $direction = 'DESC')
    {
        $this->getAll(true);

        /** @var QueryBuilder $qb */
        $qb = $this->qb;

        return $qb
            ->andWhere('error.type = :type')
            ->setParameter('type', HttpError::TYPE_FILE)
            ->orderBy($order, $direction);
    }
1035909
public function get_all_products_in( $order ) {
		$order = wc_get_order( $order );
		if ( ! $order ) {
			return [];
		}
		$products = [];
		foreach ( $order->get_items() as $item ) {
			$products[] = $order->get_product_from_item( $item );
		}
		return $products;
	}
462374
public function getUnresolvedQuery($order = 'redirection.counter', $direction = 'DESC')
    {
        $this->getAll();

        return $this->qb->orderBy($order, $direction);
    }
1002932
public function getCompleteMessage(array $order)
    {
        $vars = array(
            '@num' => $order['order_id'],
            '@status' => $this->getStatusName($order['status'])
        );

        if (is_numeric($order['user_id'])) {
            $message = $this->translation->text('Thank you for your order! Order ID: @num, status: @status', $vars);
        } else {
            $message = $this->translation->text('Thank you for your order! Order ID: @num, status: @status', $vars);
        }

        $this->hook->attach('order.complete.message', $message, $order, $this);
        return $message;
    }
1285220
protected function getTotalQtyItemsOrdered($order) {
        $qty = 0;
        $orderedItems = $order->getItemsCollection();
        foreach ($orderedItems as $item)
        {
            if (!$item->isDummy()) {
                $qty += (int)$item->getQtyOrdered();
            }
        }
        return $qty;
    }
828718
protected function getItemBagForOrder(Order $order)
    {
        $itemBag = $this->createItemBagForOrder($order);

        $event = new ItemBagEvent([
            'items' => $itemBag,
            'order' => $order
        ]);
        $this->trigger(self::EVENT_AFTER_CREATE_ITEM_BAG, $event);

        return $event->items;
    }
25420
public function getOrderCompleted(Models\Order $order)
    {
        if (!$order->hasProducts()) {
            throw new \Exception('$order should have at least one product');
        }

        return $this->getTrackPayload(ActionTypes::ORDER_COMPLETED, [
            PayloadProperties::PROPERTIES => [
                [
                    PayloadProperties::ORDER_TOTAL_PRICE => $order->getOrderTotal(),
                    PayloadProperties::PRODUCTS => $order->toArray()
                ]
            ]
        ]);
    }
193697
private static function sortKeys($array, $order)
    {
        uksort($array, function ($a, $b) use ($order) {
            $pos_a = array_search($a, $order);
            $pos_b = array_search($b, $order);

            if ($pos_a === false)
                return 1;
            if ($pos_b === false)
                return -1;

            return $pos_a - $pos_b;
        });

        return $array;
    }
56888
protected function getOrderBys($order)
    {
        $separatedOrders = [$order];

        if ($this->isMultiOrderQuery($order)) {
            $separatedOrders = explode(',', $order);
        }

        return $separatedOrders;
    }
320226
public function getOrderTotal(OrderInterface $order, $ati = false)
    {
        return $this->calculator->calculateOrderTotal($order, $ati);
    }