This article outlines a typical customer flow in Solidus on a technical level.
The
Spree::Order
model ties much of this flow together.
However, every order placed touches many Solidus models.
At a high level, this article outlines these steps of a customer flow:
Note that this article does not detail every single interaction that a Rails
server logs. Nor does it detail every single attribute on every single relevant
model. For example, it does not mention the special_instructions that a
customer might add to an order, or any of the order cancellation process.
* Promotions can be applied at any point in the pre-checkout or checkout process.
Customer arrives at the store's URL.
guest_token cookie might be generated for the customer.Customer navigates to a product page.
Customer chooses a variant of the product.
Customer chooses a quantity of the product.
Customer adds the product to their cart.
Spree::Order
object is created and given an id.
state of cart.Spree::LineItem object is created for each item in the cart.
Spree::Variant
of a product
the customer added to the cart.Spree::Variant added to
the cart.order_id value.0.0: they cannot be
calculated until after the Solidus knows the customer's address.tax_category_id for each item is set according to the
tax
category
of each item in the cart.If the customer is not logged in, the user is asked to log into their account or continue the checkout process as a guest.
Spree::Order is updated.Spree::User
ID is now associated with the Spree::Order. The user_id value is
no longer nil.
Spree::Order may be merged with the user's last
order (if that order still had a state of cart).Spree::User is
created. Its ID is now associated with the Spree::Order using
the user_id value.email of the customer is no longer nil.
email from the Spree::User
object is used as part of the order object.Spree::Order's email
value.state changes from cart to address.Customer submits shipping and/or billing address information for the order.
tax_address is set. By default, Solidus uses the
Spree::Address
ID that's being used as the order's billing
address.Spree::LineItem, a
Spree::Adjustment
is
created and stores the item's calculated tax amount.Spree::LineItem for each item in the cart is updated.
tax_address is set, the order taxes can be
calculated.additional_tax_total, included_tax_total, and adjustment_total
values are updated from nil to an integer (according to the associated
Spree::Adjustment).0.0, depending on whether the customer's shipping zone uses
value-added tax or not.Spree::Order object is updated.
bill_address_id is no longer nil and is associated with a new
Spree::Address with that ID.ship_address_id is no longer nil and is associated with a new
Spree::Address with that ID.ship_address_id and the bill_address_id would be
the same ID.address to delivery.bill_address_id and ship_address_id
values would have still been nil up until this point.Spree::Shipment
object is created.
number: H12341234123.Spree::Shipments may be created. This depends on product
availability, and a number of other (configurable) factors. For more
information see the
Shipments
documentation.Customer chooses their shipping method (if more than one is available).
Spree::Shipment object is updated.
order_id that matches the Spree::Order.state is pending.state is backorder.Spree::ShippingRate
object is created.
cost of this shipping rate on the current
order.shipment_id
value.Spree::Shipment, a
Spree::Adjustment
is
created to store the shipment's calculated tax amount.Spree::Order object is updated.
shipment_total is no longer nil. It is updated with all
shipping fees from associated Spree::Shipment objects.Customer adds a promo code to their order.
Spree::OrderPromotion object
created.Spree::OrderPromotion object associates the Spree::Order ID
with the Spree::Promotion ID.
Spree::LineItem object is updated with a new
promo_total value.Spree::Shipment object is updated with a new
promo_total value.Spree::Order's promo_total value is
updated.Spree::Order object is updated.
promo_total is no longer nil. It is updated with the values
from all promo_total values associated with the order.Customer is prompted to enter payment information.
Spree::PaymentMethods
).
Spree::PaymentMethods.Spree::Payment
object that uses a order_id to
associate with the Spree::Order.
Spree::PaymentMethod's ID.source_type and source_id associated with the
Spree::PaymentMethod and payment source being used.state of the payment is checkout.Spree::Order object is updated.
payment_state is no longer nil and is now balance_due.Customer enters their preferred payment details and submits them.
Customer reviews the confirmation screen and places order.
Spree::Payment's state changes from checkout to pending.Spree::StockItem's
count_on_hand value decrease by
the quantity of variants that have been ordered.
Administrator can opt to manually approve the shipment. (Optional.)1
Spree::Order's approver_id and approved_at values are no
longer nil.Administrator captures the payment.1
Spree::Shipment objects associated with the order are updated with a
state of ready.Spree::Payment object is updated.
state changes from pending to
processing to completed.state changes from
pending to processing to failure.Administrator ships the order and marks the order as shipped.1
Spree::Carton
object is created for each shipment
associated with the order.
number: C12341234123.Spree::Shipment's state changes from ready to shipped.Spree::Order's shipment_state changes to shipped.Administrator adds a tracking number.1
Spree::Shipment's tracking value is no longer nil.Customer waits patiently for a package in the mail.
Customer receives their product.
Note that a store's administrator workflow can be automated. ↩
Solidus is an open source platform supported by the community. We encourage everyone using Solidus to contribute back to the documentation and the code.
If you’re interested in contributing to the docs, get started with the contributing guidelines. If you see something that needs fixing and can’t do it yourself, please send us an email.