diff --git a/app/serializers/api/order_serializer.rb b/app/serializers/api/order_serializer.rb index f741675318..740d8a9fb2 100644 --- a/app/serializers/api/order_serializer.rb +++ b/app/serializers/api/order_serializer.rb @@ -22,7 +22,7 @@ module Api end def item_count - object.line_items.sum(:quantity) + object.line_items.size end def completed_at diff --git a/app/views/spree/users/show.html.haml b/app/views/spree/users/show.html.haml index 6fa0d875e2..c85ae06d75 100644 --- a/app/views/spree/users/show.html.haml +++ b/app/views/spree/users/show.html.haml @@ -1,5 +1,5 @@ - content_for :injection_data do - = inject_json_array("orders", @orders.all, Api::OrderSerializer) + = inject_json_array("orders", @orders.all.includes(:line_items), Api::OrderSerializer) = inject_json_array("shops", @shops.all, Api::ShopForOrdersSerializer) = inject_saved_credit_cards