If you look at Spree Order States, it's not that you have multiple orders in different states, just one order that could be in one particular state.
It really depends on Spree::User
. I can't find documentation and/or source for Spree::User
, but mentions to a certain LegacyUser
.
Since in the comments you mentioned you have a custom build, you need to check the actual code for Spree::User
and see if a user can have one or many orders, and if there's already a method for selecting cart state orders.
So if Spree::User
has one order:
order = user.order
order.variants.map(&:name)
Else:
order = user.orders.where(state: "cart")
order.variants.map(&:name)
There could be a method to get the order you need from the user in the code.