Case study · Shopify · Custom checkout rule

One block per order, enforced at checkout.

A supplements store sells energy drinks by the block and needed a firm limit: one block per order, whatever the flavour. Shopify has no setting for that, and a limit that lives only in the theme is easy to get around.

Client
NutriGo
Business
Supplements store
Service
Shopify stores
Built with
Shopify Functions · Cart and checkout validation · Shopify CLI
Live
nutrigo.ie ↗
nutrigo.ie
NutriGo supplements store

01The brief

What was needed.

Energy drinks in the store are sold in blocks, and one unit of a product is one block. The owner wanted every order limited to one block in total, so a customer could not get around the limit by adding one block of each flavour.

A quantity limit built into the theme only hides buttons. The cart can still be changed in other ways, and checkout would accept it. The rule had to be checked by Shopify itself.

02The work

What I built.

01

A Shopify Function

A small piece of code that Shopify runs on its own servers every time the cart changes and again at checkout.

02

Counts across flavours

The limit is on energy drinks as a group, so one block of each flavour is still over the limit.

03

New flavours are covered

Drinks are recognised by their product category, so a new flavour added to the store is limited from day one, with nothing to remember.

04

A tag for exceptions

Any other product can be put under the same limit by adding one tag in Shopify admin.

05

A clear message

A customer who goes over the limit sees why and what to change, instead of a checkout that just fails.

06

Per order, not per person

By design the limit applies to each order. Customers can order again later.

03In detail

How it works.

Why not just the theme

Most "limit quantity" solutions change what the theme shows: they hide the plus button or cap the number field. That works until the cart is changed from another page, another device or a direct link. The theme is only the shop window. The order is accepted at checkout.

A Shopify Function sits where the order is accepted. Whatever route the products took into the cart, the rule is checked before payment, and the order cannot be placed while it is broken.

Tested before it went live

Before the function was switched on in the store, I ran it locally against four saved test carts and checked the answer for each.

At launch the rule covered all 13 energy drinks in the store without listing a single one by hand.

04In numbers

What can be measured.

1block of energy drinks per order, across all flavours
13products covered at launch, picked up by category
4test carts run before the rule went live

Let's talk.

Tell me a little about the business and what you need. I'll reply within one working day.

What do you need?

We use your details only to reply to your enquiry. See our Privacy Policy.