Websites
Discount codes for your online store, checked inside the order
Discount codes for an online store take money off at checkout when a buyer types a code you created. On OneCraft the agent writes them with the loyalty guide: percent, fixed amount or free shipping codes with dates, minimums and use limits, applied by the database function that places the order, plus loyalty points if you want them.
Three kinds of code
A code takes a percent off, a fixed amount off, or makes shipping free. Each has an optional minimum subtotal, a start and end date, a use limit and an active switch, and counts how many times it has been used. You create codes in your site's admin; none are made up for you.
Checked where the order is placed
The checkout has a code field that shows the discount line, or the reason a code failed in plain words, using a preview function. The real discount is worked out again inside place_order, which looks the code up, checks its dates, limit and minimum, records the discount on the order and adds one to its use count. Visitors cannot read the codes table, so codes cannot be listed from the browser.
Loyalty points
With points, a trigger adds points to the buyer's account when an order becomes paid, and each change is kept as a point event with its reason. Redeeming points is a discount line that place_order applies. Signed-in buyers see their points and history on /account/rewards, or in a Rewards part of the Account tab in an app, and admins adjust points with a form.
Sales without a code
Products also carry a compare at price, so a product page can show the old price beside the new one for everyone, no code needed. Gift cards and referral rewards are separate capabilities; ask for them by name in the generator's features or in chat.
How it works, in three steps
Step 1
Ask for codes
Mention discount codes, and points if you want them, in the generator's brief, or ask in chat on a shop that already has a checkout.
Step 2
Connect what it needs
Codes work on orders in the site's database: a hosted one on every plan, or your own Supabase account. Paid orders need Stripe connected in account Settings, Payments.
Step 3
Make codes and publish
Create your first code in /admin, try it on a test order in the preview, then publish from the builder on a paid plan.
Limits worth knowing
- Codes are made in your site's admin; there is no discount screen in OneCraft itself.
- Points belong to signed-in buyers, so guest orders earn none.
- Stripe Checkout charges the total the order stored after the discount; codes are not Stripe promotion codes.
- Card payments need Stripe connected in account Settings, Payments, and a paid plan. The platform fee is 2% on Starter, 1% on Pro and 0.5% on Pro+, with Stripe's own fees on top.
- A hosted database comes with every plan, or you can connect your own Supabase account in the site's Settings, Database card.
- The Free plan builds and previews a site but cannot publish it, connect a domain, take payments or run Expo builds.
Questions people ask
Can a code give free shipping only above a certain spend?
Yes. Make a free shipping code and set its minimum subtotal, for example $80. Place_order checks the subtotal before applying it, and the checkout explains in plain words when the cart is under the minimum. A delivery zone can also have a free over amount, which gives free delivery to everyone above it with no code at all.
How do I stop a code being shared too widely?
Give it a use limit and an end date. Each order that uses the code adds one to its count, and once the count reaches the limit place_order refuses it. You can also switch the code off in the admin at any time. Codes cannot be read from the browser, so they only spread when people share them.
Do loyalty points work for guest buyers?
No. Points belong to a loyalty account tied to a signed-in person, so a guest order earns nothing. If points matter, give the site accounts; visitors sign in with email and password, or with Google on the published site. Points are added when an order is marked paid, not when it is placed.
Can I see which codes are being used?
The codes table in your admin shows each code's use count beside its limit and dates. Every order also keeps its discount amount, so an orders export through CSV shows how much each code took off over a period. For a dashboard tile with code totals, ask in chat; each change is a commit you can roll back.
Can a discount code and loyalty points apply to the same order?
Both are discount lines that place_order works out, so the agent can let them combine or not. Say which you want in the brief or in chat, for example that points cannot be used with a sale code. The rule then lives in the database function, where a buyer cannot get around it from the browser.
Make your own website
The button opens the generator with this use case already described. Change the wording to match yours, generate, then edit anything you like.
Create a website with OneCraftNot ready to start? See the AI website builder page first.
Related pages
Customer list for your online store, built from every order and form
A customer list for an online store gathers everyone who bought, booked or signed up into one table you can search, tag and export. On OneCraft the agent writes it into your site's admin with the crm guide: customers, notes, tags, segments and a timeline of what each person did, all private to admins.
Inventory tracking for a small online store: every change recorded
Inventory tracking for a small online store means knowing how many of each item you have, with stock going down as orders arrive and a warning before it runs out. On OneCraft the agent writes it with the inventory guide: a stock movement for every change, stock levels and a low stock list, and deliveries and stocktakes in your site's admin.
Import products from CSV with a preview before anything is added
To import products from CSV, you match a spreadsheet's columns to your product fields and add the rows in one go. On OneCraft the agent writes the importer into your site's admin with the csv guide: pick a file, see the first 50 rows with problems marked, then insert them in batches, and export any admin table the same way.
More finished work of this kind is on the website examples hub.
Written and checked by the OneCraft team. Last checked .