Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ MeasureMate โ€” Custom Price Calculator for Shopify

Sell custom-sized products with confidence. MeasureMate automatically calculates prices based on customer-entered measurements โ€” width, height, and depth โ€” and passes the correct amount securely into Shopify checkout.


๐Ÿ“Œ Table of Contents


๐Ÿ” Overview

MeasureMate is a Shopify embedded app built for merchants who sell products requiring custom measurements โ€” such as curtains, blinds, glass panels, tiles, flooring, signage, or any made-to-measure items.

Instead of requiring separate SKUs for every possible size, MeasureMate lets customers enter their desired dimensions directly on the product page. The app instantly calculates a price using merchant-defined formulas, validates the input server-side, and creates a secure checkout flow with the correct custom amount.


โœจ Features

Feature Description
๐Ÿ“ Measurement Input Collects width, height, and optional depth from customers on the storefront
๐Ÿ’ฐ Dynamic Pricing Calculates price in real-time as the customer types their dimensions
๐Ÿงฎ Multiple Formulas Area, Area + Depth, and Volume pricing models
โœ‚๏ธ Crop Support Optional crop requirement step before checkout
โš™๏ธ Merchant Config Admin interface for pricing rules, units, rounding, and min/max constraints
๐Ÿ”’ Server-Side Validation All pricing is recalculated and verified on the backend before checkout
๐Ÿ›’ Secure Checkout Shopify-native checkout handoff via backend order creation โ€” no unsafe browser-side Admin API calls
๐Ÿ“ Unit Flexibility Support for cm, mm, inches, and other measurement units

๐Ÿงฎ Pricing Formulas

MeasureMate supports three calculation models:

1. Area Pricing

Final Price = Base Price + (Width ร— Height ร— Area Rate)

2. Area + Depth Pricing

Final Price = Base Price + (Width ร— Height ร— Area Rate) + (Depth ร— Depth Rate)

3. Volume Pricing

Final Price = Base Price + (Width ร— Height ร— Depth ร— Volume Rate)

All formulas support configurable rounding, minimum price floors, and maximum constraints.


๐Ÿ› ๏ธ Tech Stack

Layer Technology
App Framework Shopify CLI + React Router Template
Frontend (Admin) React + TypeScript
Storefront UI Theme App Extension (JavaScript + Liquid)
Backend Shopify App Server (Node.js)
API Shopify Admin GraphQL API
Database Prisma ORM
Styling CSS
Containerization Docker
Linting/Formatting ESLint + Prettier
Build Tool Vite

๐Ÿ“ Project Structure

MeasureMate-Custom-Price/
โ”œโ”€โ”€ app/                        # Remix/React Router app โ€” admin UI & backend routes
โ”‚   โ”œโ”€โ”€ routes/                 # App routes (admin pages, API endpoints, app proxy)
โ”‚   โ”œโ”€โ”€ components/             # Reusable React components
โ”‚   โ””โ”€โ”€ shopify.server.ts       # Shopify auth & session handling
โ”œโ”€โ”€ extensions/                 # Shopify theme app extension
โ”‚   โ””โ”€โ”€ measuremate-widget/     # Storefront measurement input widget
โ”‚       โ”œโ”€โ”€ assets/             # Widget JavaScript logic
โ”‚       โ””โ”€โ”€ blocks/             # Liquid theme blocks
โ”œโ”€โ”€ prisma/                     # Database schema & migrations
โ”‚   โ””โ”€โ”€ schema.prisma
โ”œโ”€โ”€ public/                     # Static assets
โ”œโ”€โ”€ shopify.app.toml            # App configuration
โ”œโ”€โ”€ shopify.web.toml            # Web configuration
โ”œโ”€โ”€ Dockerfile                  # Container setup
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ README.md

โœ… Prerequisites

Before getting started, make sure you have:


๐Ÿš€ Getting Started

1. Clone the repository

git clone https://github.com/ankitpatel28/MeasureMate-Custom-Price.git
cd MeasureMate-Custom-Price

2. Install dependencies

npm install

3. Set up the database

npx prisma migrate dev

4. Start the development server

npm run dev

This will use Shopify CLI to:

  • Authenticate with your Partner account
  • Create a tunnel to your local server
  • Launch the app on your development store

5. Add the app block to your theme

  1. Go to your Shopify Admin โ†’ Online Store โ†’ Themes
  2. Click Customize on your active theme
  3. Navigate to a product page template
  4. Add the MeasureMate Widget app block
  5. Save your theme

โš™๏ธ Configuration

Once the app is installed, configure your pricing rules from the App Admin:

  1. Select a Product โ€” choose which products use custom pricing
  2. Set Formula Type โ€” Area, Area + Depth, or Volume
  3. Define Rates โ€” enter base price, area rate, and depth/volume rates
  4. Set Units โ€” choose measurement units (cm, mm, inches, etc.)
  5. Configure Constraints โ€” set min/max dimensions and min price floor
  6. Enable Rounding โ€” choose rounding strategy (none, up, nearest)
  7. Crop Requirement โ€” optionally require crop data before checkout

๐Ÿ”„ How It Works

Customer enters measurements on storefront
          โ†“
Widget calculates live price estimate
          โ†“
Customer clicks "Add to Cart" / "Buy Now"
          โ†“
App Proxy sends measurement data to backend
          โ†“
Backend validates input against merchant rules
          โ†“
Backend recalculates final price (server-side)
          โ†“
Backend creates secure checkout via Admin API
          โ†“
Customer is redirected to Shopify checkout
with the correct custom price

๐Ÿงฉ Storefront Widget API

The widget exposes a global JavaScript API for integration with external tools (e.g., image croppers):

// Set crop data from an external cropper integration
window.MeasurementPricer.setCropData({
  x: 10,
  y: 20,
  width: 300,
  height: 200
});

// Get current measurement values
const measurements = window.MeasurementPricer.getMeasurements();
// Returns: { width, height, depth, unit, estimatedPrice }

The widget also dispatches custom DOM events you can listen to:

document.addEventListener('measuremate:price-updated', (e) => {
  console.log('New estimated price:', e.detail.price);
});

๐Ÿ”’ Security

MeasureMate is built with Shopify's security best practices:

  • No Admin API access from the browser โ€” All Admin API calls (e.g., draft order creation) happen exclusively on the app's backend server, never in client-side JavaScript.
  • Server-side price recalculation โ€” The final price is always recalculated on the server before checkout is created, preventing price manipulation via browser dev tools.
  • App Proxy validation โ€” Storefront-to-backend communication goes through Shopify's authenticated App Proxy, ensuring request integrity.
  • Session-based auth โ€” Admin access uses Shopify's OAuth session flow managed by @shopify/shopify-app-remix.

๐Ÿณ Deployment

Using Docker

# Build the image
docker build -t measuremate-custom-price .

# Run the container
docker run -p 3000:3000 \
  -e SHOPIFY_API_KEY=your_api_key \
  -e SHOPIFY_API_SECRET=your_api_secret \
  -e SCOPES=write_products,write_draft_orders \
  -e HOST=https://your-app-domain.com \
  measuremate-custom-price

Environment Variables

Variable Description
SHOPIFY_API_KEY Your app's API key from the Partner Dashboard
SHOPIFY_API_SECRET Your app's API secret
SCOPES Required Shopify API scopes
HOST Your app's public URL
DATABASE_URL Prisma database connection string

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature-name
  3. Commit your changes: git commit -m 'feat: add your feature'
  4. Push to your fork: git push origin feature/your-feature-name
  5. Open a Pull Request

Please make sure your code follows the existing ESLint + Prettier configuration.


๐Ÿ“‹ Changelog

See CHANGELOG.md for a history of changes.


๐Ÿ“ฌ Support

Have a question or found a bug?


โญ Rate & Support This Project

If MeasureMate has been useful to you, please consider showing your support:

  • โญ Star this repo โ€” it helps others discover the project
  • ๐Ÿด Fork it โ€” build something great on top of it
  • ๐Ÿ› Report bugs โ€” help make it better for everyone
  • ๐Ÿ’ฌ Share feedback โ€” open a Discussion or reach out via the website

๐Ÿ“„ License

This project is licensed under the MIT License.


Made with โค๏ธ for Shopify merchants who sell custom-sized products

ankitdevhub.info

About

Shopify app for custom-sized products, calculates price automatically based on customer-entered width, height & depth measurements with server-side validation and secure checkout.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages