Adds Order#order_email to show the order's email
Summary
spree_orders table has the column email which stores the email of guest orders, this change intends to look first at this property then fallback to user's email.
This approach also makes it easier to stores to override what email to show.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
- [ ] I have written a thorough PR description.
- [ ] I have kept my commits small and atomic.
- [ ] I have used clear, explanatory commit messages.
The following are not always needed:
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
be710f3) 88.58% compared to head (deed35a) 88.58%.
Additional details and impacted files
@@ Coverage Diff @@
## main #5596 +/- ##
=======================================
Coverage 88.58% 88.58%
=======================================
Files 685 685
Lines 16404 16406 +2
=======================================
+ Hits 14531 14533 +2
Misses 1873 1873
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I'm not necessarily opposed to this change, but can you provide some more context? In all the stores I work on, the order email gets set to the user email for non-guest orders, so I'm not sure how much value this provides.
I'm not necessarily opposed to this change, but can you provide some more context? In all the stores I work on, the order email gets set to the user email for non-guest orders, so I'm not sure how much value this provides.
I have some apps that behave like PoS, where a logged-in user can create orders for others, this is just the view layer, it does not change anything at all, The previous admin used to render order.email instead of order.user&.email || order.email
How does users creating orders for others factor in? Shouldn't that use the created_by field?