npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@86d-app/bulk-pricing

v0.0.25

Published

Quantity-based tiered pricing — set volume discounts for products so customers pay less when buying in bulk

Readme

@86d-app/bulk-pricing

Quantity-based tiered pricing module for 86d. Define pricing rules that give customers volume discounts — buy more, pay less per unit. Supports percentage, fixed-amount, and fixed-price discount types across product, variant, collection, and global scopes.

Installation

import bulkPricing from "@86d-app/bulk-pricing";

const module = bulkPricing({
  defaultPriority: 0,
});

Configuration

| Option | Type | Default | Description | |--------|------|---------|-------------| | defaultPriority | number | 0 | Default priority for new pricing rules |

Store endpoints

| Method | Path | Description | |--------|------|-------------| | POST | /bulk-pricing/resolve | Resolve the bulk price for a product at a given quantity | | GET | /bulk-pricing/product/:productId/tiers | Get tier previews for a product |

Store Components

The module exports customer-facing components for MDX templates:

BulkPricingTiers

Volume pricing table showing quantity tiers with unit prices and savings. Highlights the currently active tier based on cart quantity.

<BulkPricingTiers productId="prod-123" basePriceInCents={1999} />
<BulkPricingTiers productId="prod-123" basePriceInCents={1999} quantity={10} title="Bulk discounts" />

| Prop | Type | Default | Description | |------|------|---------|-------------| | productId | string | required | Product ID to show tiers for | | basePriceInCents | number | required | Base price in smallest currency unit | | title | string | "Volume pricing" | Section heading | | quantity | number | — | Current quantity (highlights matching tier) |

Admin endpoints

Rules

| Method | Path | Description | |--------|------|-------------| | GET | /admin/bulk-pricing/rules | List rules (filter by scope, targetId, active) | | POST | /admin/bulk-pricing/rules/create | Create a pricing rule | | GET | /admin/bulk-pricing/rules/:id | Get rule detail | | POST | /admin/bulk-pricing/rules/:id/update | Update a rule | | POST | /admin/bulk-pricing/rules/:id/delete | Delete a rule | | GET | /admin/bulk-pricing/rules/:id/preview | Preview tier pricing at a base price |

Tiers

| Method | Path | Description | |--------|------|-------------| | GET | /admin/bulk-pricing/tiers | List tiers (requires ruleId) | | POST | /admin/bulk-pricing/tiers/create | Create a pricing tier | | GET | /admin/bulk-pricing/tiers/:id | Get tier detail | | POST | /admin/bulk-pricing/tiers/:id/update | Update a tier | | POST | /admin/bulk-pricing/tiers/:id/delete | Delete a tier |

Analytics

| Method | Path | Description | |--------|------|-------------| | GET | /admin/bulk-pricing/summary | Bulk pricing analytics summary |

Controller API

interface BulkPricingController {
  // Rules
  createRule(params): Promise<PricingRule>
  updateRule(id, params): Promise<PricingRule | null>
  getRule(id): Promise<PricingRule | null>
  listRules(params?): Promise<PricingRule[]>
  deleteRule(id): Promise<boolean>

  // Tiers
  createTier(params): Promise<PricingTier>
  updateTier(id, params): Promise<PricingTier | null>
  getTier(id): Promise<PricingTier | null>
  listTiers(params): Promise<PricingTier[]>
  deleteTier(id): Promise<boolean>

  // Price resolution
  resolvePrice(params): Promise<ResolvedBulkPrice>
  previewTiers(ruleId, basePrice): Promise<TierPreview[]>

  // Analytics
  getSummary(): Promise<BulkPricingSummary>
}

Discount types

  • percentage — Reduce unit price by N% (e.g., 15% off when buying 10+)
  • fixed_amount — Subtract a fixed amount from unit price (e.g., $3 off per unit)
  • fixed_price — Set a fixed unit price regardless of base (e.g., $6.99 each for 50+)

Rule scopes

  • product — Applies to a specific product ID
  • variant — Applies to a specific variant ID
  • collection — Applies to all products in a collection
  • global — Applies to all products

Types

Key types exported from the module:

  • PricingRule — A pricing rule with scope, priority, and optional date range
  • PricingTier — A quantity break with discount type and value
  • PricingScope"product" | "variant" | "collection" | "global"
  • DiscountType"percentage" | "fixed_amount" | "fixed_price"
  • ResolvedBulkPrice — Result of price resolution with matched tier/rule
  • TierPreview — Tier with computed unit price and savings percentage
  • BulkPricingSummary — Aggregate analytics
  • BulkPricingController — Controller interface

Notes

  • When multiple rules match, the highest-priority rule wins
  • Within a rule, the highest-minQuantity qualifying tier is selected
  • Unit price never goes below zero
  • Rules can be scheduled with startsAt/endsAt date range
  • The previewTiers endpoint computes unit prices and savings percentages at a given base price
  • The module requires the products module