Leaf Bible makes printed and digital Bible study and Scripture-writing tools. The printed editions are big. Depending on the layout, a complete Bible runs from about 1,200 to 4,000 printed pages.
That is perfect for some people and far too much for others. Someone working through the Gospels this year does not need Leviticus on their desk. So the store needed a way to order exactly the part of the Bible you want, without turning one product into hundreds.
One product, four ways to order
I built a selector that sits on the product page, just above the add to cart button. A customer picks how much they want:
- The complete Bible
- One volume
- A collection, like the Gospels or the Epistles
- Their own selection of books
As they choose, the page shows the page count and the price, and both update instantly.
Each product already came in a few methods and formats, so I kept that setup and added the selector on top of the printed version only. Digital downloads, shipping settings, and inventory stayed exactly as they were, which kept the risk low on a live store.
Real page counts
The price is based on pages, so the page counts have to be right. Leaf Bible’s print files are generated by small layout engines I also built, and each one writes out the exact number of printed pages for every book. The selector reads those numbers directly, so when a layout changes, the counts and prices follow it.
Pricing that stays fair
A partial order is priced by its page count, with two limits:
- A minimum price, so very small orders still make sense to print and ship
- A cap at the complete Bible’s price, so picking nearly every book never costs more than just buying the whole thing
The complete Bible always uses its normal store price.
Never trust the price from the browser
The page shows a live price, but the cart does not believe it. The cart only stores what was selected, then works out the price again on the server before checkout. Nobody can change a number in their browser and pay less.
Every order also records the volume, books, and page count in plain words, so the person printing it knows exactly what to make.
Testing on a copy, not the real store
I built all of this on a local copy of the store. That copy has the real store’s settings, which includes live payment and email accounts, so I added a small safety switch that only runs on my machine. It turns off the real payment gateways, adds a fake one for test orders, and sends every email to a local inbox instead of a customer. I could place as many test orders as I wanted without charging anyone or emailing anyone.
Two surprises at launch
Shipping it taught me two things worth passing on.
First, someone had made a small fix directly on the live server weeks earlier, and it had never made it back into the code. My deploy would have quietly undone it. I caught it, pulled the change into the code first, and now I compare the live files to the code before every deploy.
Second, the server was telling browsers to keep HTML pages for 30 days. That is fine for images, but for a page with live prices it means a returning customer could see an old price. I changed it so pages are always fresh while images and styles still cache for a long time.
The result
Customers can now order exactly the Scripture they plan to write or study, and the store still sells one product per edition instead of hundreds. It has been live since September 2026.