Inchworth / Blog / How to stop customers changing the price in a Shopify price calculator
How to stop customers changing the price in a Shopify price calculator
By Ankit Prajapati · Updated · 5 min read
To stop customers changing the price in a Shopify price calculator, the price must be set again at checkout from your own saved rule, not taken from the browser. A Shopify Functions cart transform does this, and a checkout validation Function blocks sizes you can't make, so an edited page can't change what is charged.
A size calculator on a product page is a convenience: it shows the customer what their size will cost. Whether they pay that price depends on what happens after they click Add to cart. On some setups, the number the customer sees, and could change, is the number they're charged. This guide explains where the risk comes from, which fixes don't work, and how to make sure checkout charges the price from your own rule.
Where the price lives
When a customer types a width and height, the calculator does its arithmetic in their browser and shows a total. Everything in that browser is under the customer's control. With the developer tools built into every desktop browser, anyone can change the text on a page, the value of a form field or the data a page sends.
That's harmless when the browser price is only a preview. It becomes a problem when the cart or checkout trusts a value that came from the browser. Common examples:
- the calculated price is sent to the cart as a line property, and a script or app uses it as the price;
- the calculator picks a variant or a price-adjuster quantity based on its own arithmetic, so a changed number picks a cheaper variant or a smaller fee;
- the width and height are sent as entered, with no check at checkout that they are within your limits.
Most customers would never try. But it only takes one, and made-to-measure items are often worth hundreds.
What doesn't protect you
These are often suggested, and none of them is enough on its own.
- Hiding the price field. A hidden field is still sent with the form, and can still be changed.
- Minifying or obfuscating JavaScript. It makes code harder to read, not harder to change.
- Checking orders by hand afterwards. It catches some problems, but only after the customer has paid the wrong amount, and it means awkward emails and refunds.
- Disabling right-click. Developer tools don't need it.
What does protect you: set the price at checkout
The reliable fix is to work the price out again somewhere the customer can't reach, from your own saved pricing rule, and to use that result as the price.
On Shopify, the place to do that is a Shopify Function. Functions run inside Shopify's own checkout infrastructure, not in the customer's browser.
- A cart transform Function sets the price. It reads the size and options saved on the cart line, loads your pricing rule, works out the price, and sets it on the line. Whatever the product page showed, the line is charged what the rule says. If the browser sent a price, it is ignored.
- A cart and checkout validation Function checks the size. It blocks checkout if a made-to-measure line has no size, or a size outside your minimum and maximum, with a clear message to the customer.
Together, these mean the browser only decides which size the customer wants, and your rule decides what that size costs. Changing the page changes nothing at checkout.
There's one detail worth knowing: Shopify's cart transform has more than one way to set a price, and some are limited to Shopify Plus. If you're not on Plus, check that the app you choose says its checkout pricing works on your plan. Custom size pricing without hidden variants or draft orders explains the different approaches in more detail.
Close the side doors too
Even with checkout pricing in place, a few other paths can skip the calculator:
- Buy it now buttons. On many themes, Buy it now sends the product straight to checkout without the calculator's fields. Hide it on made-to-measure products, and make sure your validation blocks lines without a size.
- Old links and saved carts. Links that add the product to the cart directly, or carts created before you set up the calculator, may not carry a size. Validation catches these.
- The product's own price. If anything does reach checkout unpriced, it will be charged the product's normal price. Set that to your minimum charge, so the fallback never undercharges.
- Order edits. If staff edit an order in Shopify admin after it's placed, the edited line isn't priced by the calculator. Check the price yourself when you edit a made-to-measure line.
How to test your own store
You can check your setup in a few minutes. Do this only on your own store.
- Open a made-to-measure product, enter a size and note the price.
- Right-click the price, choose Inspect, and change the number on the page to something much lower.
- Add the item to the cart and go to checkout.
- If checkout shows the correct price for the size, the price is being set at checkout. If it shows your edited number, it isn't.
- Repeat with a size outside your limits, if your calculator lets you type one, and check that checkout blocks it.
Do the same test with a discount code, to confirm that discounts apply to the right price.
Questions to ask before you choose an app
- Does the app set the price at checkout, or use the price sent from the browser?
- Is the price worked out from my saved rule, with sizes held to my limits?
- What happens if a cart line has no size, or an impossible size?
- Does it work on my Shopify plan?
- What does the customer see at checkout, and what does the order show?
Inchworth answers these with Shopify Functions: a cart transform prices every made-to-measure line again from your saved rule, and a checkout validation blocks lines without a valid size. You can read how it's set up in the setup guide, or compare it with other apps on the comparison page. If you're still choosing how to price, start with how to add a width × height price calculator to Shopify.
Questions
Can customers really change the price in a Shopify calculator?
If the calculator works out the price only in the browser and the cart trusts that number, yes. Anything that runs in a customer's browser can be changed by that customer with the browser's own developer tools. The fix is to work the price out again somewhere the customer can't reach, such as a Shopify Function at checkout.
Is hiding the price field or minifying the JavaScript enough?
No. Hiding a field or making code harder to read slows a curious customer down but doesn't stop them, because the browser still sends whatever values it has. Only a price set outside the browser is safe.
How can I test whether my calculator is protected?
On your own store, open the product, change the price shown on the page with your browser's inspect tool, add the item to the cart and go to checkout. If checkout still shows the correct price for the size, the price is being set at checkout. Do this only on your own store.
What about Buy it now buttons?
A Buy it now button can send a product straight to checkout without the calculator's size. Hide it on made-to-measure products, and make sure checkout blocks any made-to-measure line without a valid size.
Inchworth adds a size price calculator to your Shopify product pages, and checkout charges the same price. 14-day free trial.
Start your free trial