added if to identify cart as empty and corrected logic assigning cart order to line item when first item in cart order