After the purchase: from first order to second
TL;DR
Difficulty: Intermediate
Most first time buyers never order again, and the second order is decided in the weeks after the first.
- Put a price on one point of second order rate, and measure it by cohort and by first product, never as one blended number.
- Keep the confirmation and delivery messages free of selling, so they can go to everyone. Help first, sell second.
- Ask for reviews after the product has been used, ask everyone, and publish the bad ones too.
- Time replenishment from your own purchase intervals, and send marketing only with consent or the soft opt in.
- Prove the effect with a random holdout big enough to give an answer.
What to read first
A first order proves your shop can sell. A second order proves someone wants to come back, and most shops lose the majority of their new customers in between. This chapter walks the weeks after the first order, from the confirmation page to the win back message, with the maths, the UK rules and the code, using an invented homeware shop in Leeds.
The second order is where most customers are won or lost
A first order proves that your shop can sell. A second order proves that someone wants to come back. Between the two sits the largest leak in most online shops, and it rarely shows up in a funnel report, because the funnel ends at "thank you for your order".
Think of what a first time buyer knows at that moment. They have paid, they have not yet seen the product, they do not know whether it will arrive on time, and they have no habit of visiting your shop. Everything that happens in the next few weeks, the confirmation, the parcel, the product itself, the first email after it, decides whether your shop becomes a place they return to or a one off purchase they forget.
This chapter follows that path step by step: the confirmation page and email, delivery updates, the unboxing, review requests, the follow up messages by product type, replenishment, win back, the consent rules for each message in the UK, and how to measure whether any of it works. The wider argument for why keeping customers matters so much is in the retention maths. Here the focus is the one step that decides most of it.
Example: Wrenfield Home's 15,600 first time buyers
Wrenfield Home is an invented online homeware shop in Leeds (wrenfieldhome.example). Priya owns it, Callum is her developer. The shop sells ceramics, kitchen textiles, lamps and small furniture, about 1,400 products. It has 110,000 sessions a month, a conversion rate of 1.8% and an average order value of £72:
That is orders a month. About 1,300 of them come from people buying for the first time, so 15,600 new customers a year. Of those, 28% place a second order within twelve months:
So come back and do not. Priya spends £14,000 a month on ads, much of it to find those 15,600 people. Most of them buy once and are never seen again. That is the leak this chapter works on.
What one extra point of second orders is worth
Before you build anything, put a price on the goal. An extra second order is worth its own contribution, plus the orders that a two time customer goes on to place, because a customer who has bought twice is far more likely to buy a third time than one who has bought once.
The extra contribution from raising the second order rate is
where is the extra contribution per year of new customers, is the number of first time customers in a year, is the rise in the share of them who place a second order within twelve months, is the contribution of one order (what is left after product cost, delivery, payment fees, packaging and returns), and is the average number of further orders a customer places after their second one within the period you care about. It is an expected value: a probability times a payoff, summed over customers, see Foundations: expected value.
The contribution per order comes from the unit economics chapter, and comes from your own order history: take customers who placed a second order at least two years ago and count what they ordered after it.
Example: Priya's three points
Wrenfield's contribution per order is , worked out in the unit economics chapter. Callum looks at the customers whose second order was in 2023 and finds they placed on average further orders within the following two years. Priya wants to know what lifting the second order rate from 28% to 31% is worth, so :
Three points mean more customers who come back, and £22,307 of extra contribution from each year's new customers. One point is worth about £7,436. That number is the budget ceiling for everything below: a printed card, a better email, a developer's week. Anything that costs less and moves the rate by a point pays for itself within the year.
Measure the second order rate by cohort, not as one number
The most common mistake is to measure repeat purchase as one blended number, such as "35% of our orders come from returning customers". That number mixes old loyal customers with new ones, rises when you stop acquiring and falls when you grow. It cannot tell you whether this year's first time buyers come back more often than last year's.
The fix is a cohort: a group of customers who placed their first order in the same period. For each cohort, you measure the share who placed a second order within a fixed number of days:
where is the second order rate within days of the first order, is the number of customers in the cohort, and is how many of them placed a second order within days. It is a plain ratio, see Foundations: ratios and rates.
One rule matters more than any other: only compare cohorts that have all had the full days. A cohort from last month cannot show a 90 day rate yet, and if you include it, the rate looks worse than it is. This is called censoring, and the chapter on repeat purchase and churn explains it in depth. The full cohort table, with revenue and contribution per cohort, is in the cohort analysis chapter. This chapter only needs the one column: did they come back.
Example: the query Callum runs every month
Wrenfield runs on Solidus, so every order sits in the spree_orders table with the customer's email and the time the order was completed. Callum identifies customers by their email address in lower case, so that a guest order and a later account order from the same person count as one customer. This query gives the 90 day second order rate for every monthly cohort old enough to have had the full 90 days:
WITH orders AS (
SELECT lower(email) AS customer, completed_at
FROM spree_orders
WHERE completed_at IS NOT NULL
AND state <> 'canceled'
),
ranked AS (
SELECT customer, completed_at,
ROW_NUMBER() OVER (PARTITION BY customer ORDER BY completed_at) AS n
FROM orders
),
firsts AS (SELECT customer, completed_at AS first_at FROM ranked WHERE n = 1),
seconds AS (SELECT customer, completed_at AS second_at FROM ranked WHERE n = 2)
SELECT date_trunc('month', f.first_at) AS cohort,
COUNT(*) AS customers,
ROUND(100.0 * COUNT(*) FILTER (
WHERE s.second_at < f.first_at + INTERVAL '90 days'
) / COUNT(*), 1) AS second_order_within_90_days
FROM firsts f
LEFT JOIN seconds s USING (customer)
WHERE f.first_at < now() - INTERVAL '90 days'
GROUP BY 1
ORDER BY 1;
Read it from the top. The first block takes every completed order that was not cancelled. The second numbers each customer's orders in time order. The third and fourth pick out the first and the second order. The last block groups customers by the month of their first order and counts how many placed a second order within 90 days. The final WHERE line is the censoring rule: cohorts younger than 90 days are left out.
Callum runs the same query with 30, 60, 180, 270 and 365 days, and plots two cohorts: customers whose first order was between January and March 2025, before Priya changed anything, and the same months of 2026, after the new post purchase sequence started.
Two things stand out. The 2026 line sits higher at every point it can show. And it stops at 180 days, because on 22 November 2026 the March 2026 customers have had about 235 days, not 270. Callum does not fill the gap with a guess.
Is the 2026 line higher because of the new sequence? Not necessarily. The ad mix changed in 2026, and a different mix of new customers comes back at a different rate. A before and after comparison suggests, it does not prove. The proof comes later in this chapter, from a holdout.
The first product predicts the second order
Not every first order has the same chance of a second. Someone who bought a mug may want the matching plates. Someone who bought a sofa will not buy another for years. If you treat all first time buyers the same, you send sofa buyers emails about sofas and mug buyers nothing in particular.
So split the second order rate by what was in the first order. Use the product category, or a grouping you define, and only cohorts old enough to have had the full twelve months.
Example: second order rate by first category
Callum takes all first time buyers from 2024 and groups them by the main category of their first order (the category with the highest value in the basket).
The weighted average checks out against the overall figure:
That is , the 28% from the start. The lesson for the sequence: ceramics and textiles buyers come back on their own more often, because the categories invite collecting and replacing. Lamp and furniture buyers need a different reason to return, and a different time to be asked. The sequence later in this chapter is built on exactly this split.
The order confirmation page is the calmest moment you will get
The confirmation page is the one page every buyer sees and almost nobody designs. The customer has just paid. They are not comparing prices any more. They are mildly anxious ("did it work?") and paying full attention. That makes it the right moment for three things, in this order:
- Reassurance. The order number, what was ordered with pictures, the delivery address, the expected delivery date as a date rather than "3 to 5 working days", the payment method, and that a confirmation email is on its way to the address they typed. If the email address has a likely typo, this is the last chance to fix it.
- What happens next. When the parcel leaves, how they will hear about it, how to change or cancel, how to reach a person.
- One small optional ask. One question that helps you serve them better, for example "Who is this for?" with three buttons. The chapter on knowing your customers covers how to ask it well. Or an account created from the guest order with one click, using the details they already gave.
What does not belong there: a second checkout, a countdown, a pop up. Product suggestions can work on this page if they match what was just bought, and the recommendations chapter explains which kind belongs here. Keep them below the reassurance, never above it.
Example: Priya's confirmation page, before and after
Before: "Thank you for your order!" with an order number, a row of eight bestsellers and a newsletter box.
After, in this order:
- "Order WH48213 is confirmed. A copy is on its way to sam.taylor@example.com."
- The three items with pictures, the delivery address, and "Arrives Thursday 14 January by Royal Mail Tracked 48".
- "I'll email you when it leaves the warehouse, usually the next working day." Callum writes the copy in Priya's voice, because it is her shop.
- "Who is this for? Me, a gift, my home or office." Three buttons, optional.
- For guests: "Save your details for next time" with a password field and nothing else.
- Four products that go with what was bought, under the heading "Goes with your order".
The guest account option is taken by 11% of guests in the first month. Each of those accounts makes the second order faster, because the address and saved details are already there.
The confirmation email is a legal duty before it is a marketing channel
In the UK, when you sell at a distance, you must send the customer a confirmation of the contract on a durable medium, such as an email they can keep. Regulation 16 of the Consumer Contracts Regulations 2013 sets this out: the confirmation must include the pre contract information listed in Schedule 2 (unless you already gave it on a durable medium), and it must arrive within a reasonable time and at the latest when the goods are delivered.1 So the confirmation email is not optional, and it carries real information: what was bought, the total price including delivery, your identity and address, and the right to cancel with the model cancellation form.
That matters for what else you put into it. The Information Commissioner's Office (ICO) says that messages sent purely for administrative or customer service purposes, often called service messages, are not direct marketing, but if you add advertising or marketing material, the message becomes direct marketing.2 Once it is marketing, the rules for marketing emails apply to it, covered later in this chapter. A confirmation email with a row of "you might also like" products is a marketing email to anyone who has opted out.
The practical answer is to keep the confirmation clean. It is the most opened email you send, so it is tempting to load it. Resist. Make it the clearest document of the order the customer will ever get, and put the selling into separate messages that respect consent.
Example: what goes into Wrenfield's confirmation email
Callum checks the email against Schedule 2 and Priya's terms and ends up with this content, top to bottom:
| Block | Content |
|---|---|
| Header | "Your order WH48213 is confirmed", order date |
| Items | Product names, variants, quantities, prices |
| Totals | Subtotal, delivery, total including VAT |
| Delivery | Address, method, expected date |
| Seller | Wrenfield Home's legal name, address, email and phone |
| Your rights | 14 day right to cancel, how to do it, link to the model cancellation form, returns address |
| Help | One line on how to reach a person |
What is not in it: product recommendations, a discount for the next order, a newsletter call to action. The care tips for ceramics are not in it either, because they work better when the parcel has arrived. Those go into the sequence below.
Delivery updates answer "where is my order" before it is asked
The time between payment and delivery is when a new customer is most uncertain. If they hear nothing, some will write to ask, and every such contact costs you staff time and costs the customer some confidence. Shops call these "where is my order" contacts.
The fix is simple and pure service: tell people before they need to ask. Three messages cover most of it:
- Dispatched, with the carrier, the tracking link and the expected date.
- Delayed, sent by you the moment you know, with a new date. Never wait for the customer to notice.
- Delivered, only if your carrier tells you, with one line on what to do if something is damaged.
These are service messages, so they go to every customer, including those who have refused marketing, as long as they contain no selling.
Example: the contacts Priya stops getting
Before the change, Priya's inbox and phone log show that 7.5% of orders lead to a "where is my order" contact:
About contacts a month, each taking about six minutes to look up and answer, so roughly 15 hours a month. Callum adds the dispatched email with tracking and a delay email triggered when a parcel has not moved for two working days. Three months later, the rate is 3.0%:
That is contacts, about six hours a month. Nine hours a month are back, and 90 customers a month never had the worried moment that made them write.
How the dispatch message is built in Solidus
In Solidus, a shipment leaves the warehouse in a carton. When a carton is shipped, Solidus publishes a carton_shipped event on its event bus, Spree::Bus.3 Solidus also sends its own shipped email through Spree::CartonMailer#shipped_email, which receives the carton and the order and includes the tracking details,4 so the dispatched message is mostly a matter of rewriting that template in your shop's voice. The event is what you use for everything that should happen after dispatch, such as planning the later messages. The Solidus guides show how to subscribe to events with an Omnes subscriber.5
# app/subscribers/wrenfield_home/after_purchase_subscriber.rb
module WrenfieldHome
class AfterPurchaseSubscriber
include Omnes::Subscriber
handle :carton_shipped, with: :plan_steps, id: :wrenfield_after_purchase
def plan_steps(event)
carton = event.payload[:carton]
carton.orders.each do |order|
AfterPurchase::Planner.new(order, shipped_at: carton.shipped_at).call
end
end
end
end
# config/initializers/omnes.rb
Rails.application.config.to_prepare do
WrenfieldHome::AfterPurchaseSubscriber.new.subscribe_to(Spree::Bus)
end
In plain words: whenever a carton is shipped, the subscriber looks at every order that has items in that carton and asks a planner (shown later) to schedule that order's follow up messages, counted from the day the parcel left. The planner lives in Wrenfield's own code, not in Solidus.
The unboxing is the end of the experience, and the end is what people remember
Opening the parcel is the first time the customer touches what they bought. It is also the last scene of the purchase, and there is good evidence that the end of an experience weighs heavily in how it is remembered. In a laboratory study by Daniel Kahneman and colleagues, people held a hand in painfully cold water twice: once for 60 seconds, and once for 60 seconds followed by 30 more seconds at a slightly less cold temperature. Asked which trial to repeat, most chose the longer one, because it ended better.6 That is a study of pain, not of parcels, so treat it as a reason to care about the ending, not as a forecast of your sales.
For a shop, the ending is concrete: the product arrives undamaged, it is easy to unpack, it looks like the photos, and the parcel contains what the customer needs next. That last part is where most shops do nothing. Good inserts are useful, not promotional:
- A care card for ceramics (dishwasher, oven, microwave, what to avoid).
- Washing instructions for linen, with what to expect after the first wash.
- For lamps, the bulb type and wattage, so the customer knows what to buy when it fails.
- For furniture, assembly steps and how to look after the wood.
- A short note with a name, a phone number or email for problems, and the returns steps.
A discount code for the next order can go in the parcel too, but price it with the offers chapter first, because most people who use it would have come back anyway.
Example: the care card that pays for itself
Callum checks the order data: about 45% of Wrenfield's orders contain ceramics, so
About parcels a month would get a printed care card. At £0.06 per card, that costs
That is a month. At £19.86 contribution per order, the cards pay for themselves if they bring about three extra orders a month:
About 585 of those parcels go to first time buyers each month (1,300 of the 1,980 monthly orders are first orders), so three extra second orders means lifting their second order rate by about points. Priya thinks that is plausible but not certain, so the card goes into every second parcel for three months, chosen by order number, and Callum compares the two groups' second order rates afterwards.
Review requests: when to ask, how to ask, and what the law forbids
A review helps three people: the next shopper, who learns something real, you, because reviews answer questions your product page cannot, and the reviewer, who gets a voice. How much reviews affect buying decisions is covered in the social proof article. This section is about the request itself.
Ask after the customer has used the product
The most common mistake is asking on dispatch, or on the day of delivery. The customer has not used the product yet, so they review the delivery, not the product, or ignore the email. The right moment depends on the product:
| Product | Ask after delivery | Why |
|---|---|---|
| Ceramics | 10 days | Used, washed, maybe chipped |
| Kitchen textiles | 14 days | Washed at least once |
| Lamps | 14 days | Used in the evenings, bulb fitted |
| Small furniture | 30 days | Assembled, lived with, settled |
Ask once, with at most one reminder. Ask about the product, by name and with a picture, and make the first step one tap: the star rating inside the email, with the text optional on the next screen.
Ask everyone, and never pay for praise
In the UK, the Digital Markets, Competition and Consumers Act 2024 lists banned practices in Schedule 20. Paragraph 13 bans submitting or commissioning fake consumer reviews, and reviews that conceal that they were incentivised. It also bans publishing reviews in a misleading way, which explicitly includes failing to publish negative reviews while publishing positive ones, and giving greater prominence to positive reviews over negative ones.7 Commissioning, in the Act's words, includes incentivising by any means.
The Competition and Markets Authority (CMA) guidance on this paragraph spells out what that means for review requests. Cherry picking positive reviews over negative ones can happen through suppressing negative reviews, or "by encouraging just those who are satisfied to leave reviews". Traders should not interfere with negative reviews, for example by arbitrarily stopping and starting review invitations, or by making dispute resolution depend on the customer not leaving a negative review.8
For a shop, that turns into four plain rules:
- Invite every buyer, or a random sample. Never "only send the request if the customer rated us four stars in a survey first".
- No reward for a review, unless the review is clearly marked as incentivised on your site. A prize draw for reviewers counts as an incentive.
- Publish the bad ones. Remove only reviews that break published rules (abuse, personal data, not about the product).
- Never trade a refund for silence. A complaint is handled on its merits, whether or not the customer reviews.
A review request is safest treated as marketing
Is a review request a service message or marketing? The ICO's line is clear for the mixed case: once a message carries advertising or marketing material, it is direct marketing.2 A review request with "you might also like" underneath is therefore marketing. A plain request with nothing to sell is closer to a service message, but the ICO page does not settle that case. The simple design choice is to send review requests only to customers you are allowed to market to anyway, and to include the opt out in every one. You lose a few reviews and gain a clean rule.
Example: how many reviews Wrenfield can expect
Of 1,980 orders a month, 86% come from customers who have not opted out of emails, so
About review requests go out, each at the right time for its product. Before the change, requests went out on dispatch and 4% produced a review. With the new timing and the star rating inside the email, 9% do:
That is reviews a month instead of about . The share of one and two star reviews rises slightly, from 6% to 8%, because people now review the product after using it. Priya publishes them all, answers each critical one in public, and passes product faults to her suppliers. That is the system working, not failing.
The post purchase sequence, by product type
A post purchase sequence is the set of messages a customer gets after the order, each triggered by time or by an event. Most shops have one generic "thanks for your order, here are our bestsellers" email at day seven. A sequence built by product type works better, because the customer's next question depends on what they bought.
The rule for each message: help first, sell second, and only where the customer's next need is obvious. Care tips are help. "This mug has matching plates" is selling, and fine, if the customer may receive marketing. "Here is a sofa" to someone who bought a sofa a week ago is noise.
Example: the four tracks at Wrenfield
Callum and Priya write one track per category, counted in days after delivery:
| Day | Ceramics | Kitchen textiles | Lamps | Small furniture |
|---|---|---|---|---|
| 1 to 3 | Care tips: dishwasher, oven, chips | Washing tips, shrinkage to expect | Bulb type and how to change it | Assembly help, wood care |
| 10 to 30 | Review request (day 10) | Review request (day 14) | Review request (day 14) | Review request (day 30) |
| 21 to 30 | "Matching pieces in the same glaze" (day 21) | none | "Shades and a second lamp for the same room" (day 30) | "Cushions and throws in the sofa's colours" (day 21) |
| Later | Replenishment where it applies | Replenishment at the customer's interval | none | Wood care oil at the oil's interval |
Two details make the furniture track work. The complementary email waits until day 21, because a customer who has just bought a two seater sofa wants to live with it before deciding on cushions, and wants to see the colour in their own room. And the email shows cushions and throws in colours chosen for that sofa's fabric, from a rule Priya maintains by hand: 12 fabrics, each with eight matching products. No algorithm needed.
The lamp track is the opposite. Lamp buyers had the lowest second order rate after furniture (21%), and the most common second purchase among those who did come back was a second lamp or a shade for the same room. So the day 30 email shows exactly that.
Replenishment: time the reminder from the gap between purchases
Some products run out or wear out: wood care oil, candles, tea towels, coffee filters. For those, the second order has a natural time, and the shop can find it in its own data. The gap between two purchases of the same product by the same customer is called the inter purchase interval.
Do not send the reminder at the average gap. By the average, half the customers who were going to buy again have already bought, some of them elsewhere. Send it a little before most of them run out: at the 25th percentile of the gap (the point a quarter of the way up the sorted list of gaps), minus the delivery time, minus a few days to decide:
where is the number of days after the last purchase when the reminder goes out, is the 25th percentile of the inter purchase interval for that product, is the usual delivery time in days, and is a buffer in days for the customer to decide. A percentile is the value below which a given share of the sorted data lies, see Foundations: median and mode.
If a customer has already bought the same product twice or more, use their own last gap instead of the shop's percentile. People are consistent, and their own rhythm beats the average.
Example: wood care oil and linen tea towels
Wrenfield sells a wood care oil for its oak furniture. Callum finds 412 customers who bought it at least twice and sorts the gaps between their first and second bottle. A quarter of the gaps are 119 days or shorter, the median is 161 days and three quarters are 214 days or shorter. Delivery takes two days, and Priya allows five days to decide:
So the reminder goes out days after the last bottle. It says, in Priya's words, "If your oak is looking dry, here is the oil you used last time", with a one click reorder link that fills the basket with the same product.
For the linen tea towels, 238 customers bought a second set. The 25th percentile is 182 days, so with the same and :
The reminder goes at day . For a customer who has bought tea towels three times, with a last gap of 150 days, Callum uses days instead.
Win back: a reminder first, a discount only where the maths says so
Some first time buyers will not come back on their own. When should you try to bring them back, and with what? The full method, with the probability that a customer is still active and the break even maths for a win back discount, is in the chapter on repeat purchase and churn. Its conclusion for first time buyers is short: the longer someone stays silent, the less likely they are to return, so a win back message belongs at the point where the curve of second orders starts to flatten, and a discount only pays for customers who would almost certainly not have ordered anyway.
Example: day 200 at Wrenfield
In the cohort data, half of the customers who placed a second order did so within about 200 days. So Priya's win back message goes to first time buyers who have not ordered by day 200 and may receive marketing. It has no discount. It shows what is new in the category they bought from, and it asks one question with three buttons: "Not for me", "Later" or "Show me more". A "Not for me" click ends the sequence for that customer.
A discount is tested only for the group the scoring model rates least likely to return, and only with a random holdout, as in the churn chapter. Everything else would give margin to people who were coming back anyway.
Consent: who may receive which message
Everything in the sequence that sells needs a legal basis to be sent. This section is general information on the UK rules, not legal advice.
The Privacy and Electronic Communications Regulations 2003 (PECR) require consent for marketing by email, with one exception, often called the soft opt in. Regulation 22(3) allows marketing email to someone whose details you obtained in the course of a sale or negotiations for a sale, as long as the marketing is about your own similar products and services, and the person was given a simple, free way to refuse when the details were collected and in every message after that.9 PECR's definition of "electronic mail" includes text messages,10 so the same rule covers SMS. The design of the consent itself, at checkout and in sign up forms, is covered in the consent by design article, and the sending side of email and SMS in the email and SMS chapter.
Two more rules shape the sequence. Under Article 21 of the UK GDPR, a person can object to their data being used for direct marketing at any time, including profiling related to it, and after that their data may no longer be used for that purpose.11 So an unsubscribed customer drops out of the review requests, the complementary emails, the win back message and the scoring that chooses who gets which one. And the soft opt in only covers your own similar products: homeware to a homeware customer is fine, a partner's insurance offer is not.
| Message | Type | Who may receive it |
|---|---|---|
| Confirmation email | Service, legally required | Every buyer |
| Dispatch, delay and delivery updates | Service | Every buyer |
| Care or assembly tips, nothing to buy | Service | Every buyer |
| Review request | Treated as marketing | Consent or soft opt in, not opted out |
| Complementary products | Marketing | Consent or soft opt in, not opted out |
| Replenishment reminder | Marketing | Consent or soft opt in, not opted out |
| Win back message | Marketing | Consent or soft opt in, not opted out |
| Any of the above by SMS | Same as by email | Same rules, with the opt out in every text |
Example: Callum's checkout and the rules it feeds
At checkout, under the email field, Wrenfield shows one sentence and one box: "I'll send you occasional emails about new homeware and care tips. Tick this box if you'd rather not." The email address was obtained in the course of a sale, the emails will be about Priya's own homeware, and the customer can refuse right there, so the soft opt in applies. Every marketing email has a one click unsubscribe at the foot. Of the 1,980 monthly orders, 14% tick the box or unsubscribe later, which is where the 86% in the review example comes from.
For SMS, Callum does not rely on the soft opt in. The phone number at checkout is collected for the courier, and customers do not expect marketing texts from it. Wrenfield sends only service texts (delivery slot, delay) unless the customer ticks a separate box for marketing texts.
Build it: one planner, one daily job, one permission check
The pieces above become a small amount of code in your own shop. The subscriber shown earlier calls a planner when a parcel leaves. The planner turns the tracks into dated steps in a table. A daily job sends the steps that are due, after checking that the order still stands and that the customer may receive that kind of message.
# app/services/after_purchase/planner.rb
module AfterPurchase
class Planner
TRANSIT = 2.days
# group => [[step, days after delivery, kind], ...]
STEPS = {
"ceramics" => [["care_tips", 3, "service"], ["review", 10, "review"],
["matching_pieces", 21, "marketing"]],
"textiles" => [["care_tips", 2, "service"], ["review", 14, "review"]],
"lamps" => [["bulb_guide", 1, "service"], ["review", 14, "review"],
["second_lamp", 30, "marketing"]],
"furniture" => [["assembly_care", 1, "service"], ["review", 30, "review"],
["cushions_and_throws", 21, "marketing"]]
}.freeze
def initialize(order, shipped_at:)
@order = order
@delivered_on = (shipped_at + TRANSIT).to_date
end
def call
groups.flat_map { |group| STEPS.fetch(group, []) }
.sort_by { |_step, days, _kind| -days } # the later date wins
.uniq { |step, _days, _kind| step }
.each do |step, days, kind|
AfterPurchaseStep.find_or_create_by!(order: @order, step: step) do |s|
s.kind = kind
s.send_on = @delivered_on + days
end
end
end
private
def groups
@order.line_items.map { |item| item.product.property("after_purchase_group") }
.compact.uniq
end
end
end
The planner reads a product property called after_purchase_group, which Priya sets once per product in the Solidus admin (Solidus products have a property method for exactly this kind of value). For each group in the order, it takes that group's steps. If an order has both ceramics and a sofa, both want a review request, and the later date wins, so nobody is asked about a sofa they assembled yesterday. find_or_create_by! makes the planner safe to run twice, for example when an order ships in two cartons.
# app/jobs/after_purchase/send_due_steps_job.rb
module AfterPurchase
class SendDueStepsJob < ApplicationJob
def perform(today = Date.current)
AfterPurchaseStep.pending.where(send_on: ..today).includes(:order).find_each do |step|
order = step.order
if order.canceled? || order.returned?
step.skip!("order no longer stands")
elsif step.kind == "service"
deliver(step)
elsif !MarketingPermission.allows?(order.email)
step.skip!("no marketing permission")
elsif Holdout.member?(order.email, "after_purchase_2027")
step.skip!("holdout")
else
deliver(step)
end
end
end
private
def deliver(step)
AfterPurchaseMailer.with(step: step).public_send(step.step).deliver_later
step.sent!
end
end
end
# app/models/holdout.rb
class Holdout
def self.member?(key, experiment, share: 0.2)
Digest::SHA256.hexdigest("#{experiment}:#{key.downcase}").to_i(16) % 100 < share * 100
end
end
# config/recurring.yml
production:
after_purchase_steps:
class: AfterPurchase::SendDueStepsJob
schedule: every day at 9am
Read the job as a list of questions for each step that is due. Has the order been cancelled or returned? Then skip it. Is it a service message? Then send it. Is the customer not allowed to receive marketing? Then skip it and record why. Is the customer in the holdout group? Then skip it, so the effect can be measured. Otherwise, send it. AfterPurchaseStep, MarketingPermission and Holdout are Wrenfield's own small models, not part of Solidus. The holdout assignment uses a hash of the email address, so the same customer always lands in the same group, with no table to maintain. The schedule runs on Solid Queue's recurring tasks, the job backend that ships with Rails 8.12
Every step is recorded with a reason when it is skipped. That record answers the two questions that come up later: "why did this customer get that email?" and "why did that customer not?".
Could this run on a rented platform? Largely, yes. Shopify describes its own marketing tools as a way to stay connected with customers who have purchased from your store before,13 and for a small shop with simple products, a ready made post purchase flow is a fair choice. What changes in your own system is that the sequence can read anything the shop knows, such as the fabric of the sofa, the delivery date from the carrier, the stock level of the matching plates and the customer's own reorder interval, and that every step and its reason live in your own database. The chapter on where Rails and Solidus shine weighs this honestly.
Measure the sequence with a holdout, not with email clicks
Email tools report clicks and "attributed revenue": orders placed within a few days of a click. That number credits the email with orders that would have happened anyway, and a post purchase email goes to people who are, by definition, already customers. The only honest measure is a comparison with a random group that did not get the marketing messages: a holdout. The method in full, including how to choose the size, is in the experiments chapter.
The result is a difference between two proportions, and the question is whether it is bigger than chance. The standard error of the difference is
where is the standard error of the difference, and are the second order rate and the number of customers in the group that received the sequence, and and are the same for the holdout. A 95% confidence interval for the difference is . If it does not include zero, the difference is unlikely to be chance alone, see Foundations: confidence intervals.
Example: two quarters of Wrenfield's sequence
The sequence ran for first time buyers in the first and second quarter of 2026: about 7,800 customers, of whom 20% were held out at random. So and . The outcome is a second order within 90 days. The sequence group reached , the holdout . The difference is , or 1.9 points.
This is the standard error formula from above with Wrenfield's numbers, see Foundations: confidence intervals. The margin is , so the 95% interval runs from to : between 0.2 and 3.6 points. Zero is outside it, so the sequence works. How much it works is still uncertain: somewhere between barely and a lot.
Why 20% and not the usual 10%? Callum checked before starting. With a 10% holdout, and , and the same rates would give
which is the same formula with the smaller holdout, see Foundations: sample size. That gives a margin of and an interval from to , which includes zero. The test would have run for six months and answered nothing. The holdout gives up a little revenue to buy an answer, and Priya decided the answer was worth it.
What is the 1.9 point lift at 90 days worth? If it carries through to twelve months at the same size, the formula from the start of the chapter gives a year of extra contribution. That is an estimate on top of an estimate, and Priya treats it as one. The holdout stays in place, at 10% now that the effect is established, so the estimate keeps being checked.
What to build first
Not everything at once. In order of effort against effect:
- Measure. The cohort query and the chart by first category. One day of work, and it tells you which tracks matter most.
- Clean the confirmation email and page. Legally required content, the delivery date, the guest account option. Two or three days.
- Dispatch and delay messages. Mostly a template in Solidus, plus one job for stalled parcels. Pays back in support time within weeks.
- Care and assembly tips. Service messages to everyone, written once per category.
- Review requests at the right time, sent to everyone you may contact, published unfiltered.
- Complementary and replenishment emails, with the holdout in place from the first send.
- Win back, last, because it depends on the scoring and the holdout being in place.
Example: Wrenfield's first eight weeks
Weeks one and two: the cohort query, the chart, the confirmation page and email. Weeks three and four: dispatch and delay messages, the care cards in every second parcel. Weeks five and six: the planner, the daily job, care tips and review requests. Weeks seven and eight: the complementary emails for ceramics, lamps and furniture, the replenishment reminders for oil and tea towels, and the holdout switched on. The win back message follows in month four, once the first customers reach day 200.
Conclusion
Most first time buyers never order again, and most shops never ask why, because the funnel ends at the confirmation page. The second order is decided in the weeks after the first: by a confirmation that reassures, delivery updates that arrive before the worry does, a parcel that ends the experience well, and messages that help with what was bought before they sell anything else.
Put a price on the goal first. At Wrenfield, one point of second order rate is worth about £7,436 a year. Measure the rate by cohort and by first product, never as one blended number. Keep service messages free of selling, so they can go to everyone. Send review requests to everyone you may contact, after the product has been used, and publish what comes back. Time replenishment from your own data. And measure the whole sequence against a random holdout big enough to answer, because a click is not a second order.