What Shopify Already Provides for B2B Pricing

Before reaching for Shopify Functions, it is important to understand how much B2B pricing Shopify handles natively through catalogs. On Shopify Plus, B2B catalogs are the primary tool for setting company-specific pricing, and they cover a lot of ground.

What B2B catalogs support:

  • Overall percentage adjustments: Apply a blanket discount (e.g., 20% off retail) across all products for a specific company. This is the fastest way to set wholesale pricing.
  • Fixed prices per product or variant: Override the percentage adjustment with exact prices for specific items. Fixed prices take priority over percentage adjustments, so you can set a general discount and then pin key products to negotiated prices.
  • Quantity rules: Enforce minimum order quantities, maximum order quantities, and quantity increments (e.g., must order in packs of 12) at the catalog level.
  • Volume pricing: Offer price breaks based on quantity tiers (e.g., 1-49 units at $10, 50-99 at $8, 100+ at $6) within a catalog.

For a deeper walkthrough of these features, see our guides on customer-specific pricing and volume-based pricing and MOQs.

Key requirement: B2B catalogs (and all native B2B features) require Shopify Plus. B2B customers must be set up as companies with company locations in your Shopify admin, not just standard customer accounts. If you are not on Plus yet, see our B2B Shopify Features Quick Overview to understand what the upgrade enables.

Where B2B Catalogs Reach Their Limit

Catalogs handle company-specific price lists well, but they do not cover every pricing scenario a B2B merchant might need. Here is where they fall short:

  • Conditional discounts. Catalogs set prices statically. They cannot express logic like "apply an extra 5% off if the order exceeds $5,000" or "discount this product category only when purchased with a specific accessory."
  • B2B-only promotions in blended stores. If you run a single store serving both D2C and B2B customers, discounts and discount codes apply to everyone by default. Catalogs control base pricing, but they do not control discount eligibility.
  • Time-limited or event-based pricing. Catalogs do not natively support "10% off all orders this week for B2B buyers" without manually updating the catalog and reverting it afterward.
  • Code-based discounts restricted to B2B. If you create a discount code in Shopify, both D2C and B2B customers can use it unless you add custom logic to restrict eligibility.

These gaps are where Shopify Functions come in.

What Shopify Functions Are (and Are Not)

Shopify Functions are lightweight, custom code extensions that run at specific points in the Shopify checkout and backend. They let you inject business logic into Shopify's native processes without building a full custom app.

What they are:

  • Server-side code (written in Rust, JavaScript, or TypeScript via Shopify's CLI) that executes within Shopify's infrastructure.
  • Tied to specific extension points (discount functions, delivery customization, payment customization, cart/checkout validation, etc.).
  • For B2B pricing, the relevant extension point is discount functions, which let you create custom rules for when and how discounts apply.

What they are not:

  • Functions are not a replacement for B2B catalogs. They do not set base prices. They apply discount logic on top of whatever pricing is already in place (catalog pricing, retail pricing, or both).
  • Functions are not a no-code tool. They require development work to build and deploy. You need a developer (or a Shopify app that uses Functions under the hood).
  • Functions do not have access to external APIs at runtime. They receive a defined set of input data from Shopify (cart contents, customer identity, metafields) and must return a result based on that data alone.

How Discount Functions Work with B2B Identity

The key capability that makes Shopify Functions useful for B2B pricing is company-aware targeting. When a B2B customer is logged in and shopping, Shopify includes their company identity in the data passed to Functions.

What the function receives:

  • Whether the customer has an associated company (this is the core B2B signal)
  • The company location the customer is ordering for
  • Cart contents (line items, quantities, product details)
  • Any metafields attached to the customer, company, or products

What the function can do with this:

  • Check if a company is present. If yes, apply the discount. If no (D2C customer), skip it.
  • Read a metafield on the company (e.g., customer_tier: "gold") and apply different discount logic based on tier.
  • Validate whether a discount code should be accepted or rejected based on B2B status.

This company-aware check is what allows you to create B2B-only discounts in a blended store, something that is not possible with standard Shopify discount settings alone.

Common Shopify Functions Patterns for B2B Pricing

Here are the most common ways B2B merchants use discount functions:

B2B-only automatic discount

Use case: You want an automatic discount (e.g., free shipping on orders over $1,000, or 5% off all orders) that applies only to B2B customers, not D2C shoppers.

How it works: The function checks whether the customer has a company associated with their account. If a company is present, the discount applies automatically. If not, the cart is unchanged.

Why you cannot do this with native discounts: Standard automatic discounts in Shopify apply to all qualifying orders regardless of customer type. There is no built-in filter for "B2B only."

B2B-only discount code eligibility

Use case: You distribute a discount code (e.g., WHOLESALE10) to your B2B accounts, but you do not want D2C customers to use it if they find it.

How it works: The function intercepts the discount code at checkout and checks whether the customer has a company. If no company is present, the code is rejected. If a company is present, the code is accepted and the discount applies.

Why this matters: Discount code leakage (B2B codes being used by retail customers) is a common problem in blended stores. A discount function solves it cleanly.

Tiered discounts based on company metadata

Use case: You have three B2B tiers (Silver, Gold, Platinum) and want automatic discounts that scale by tier, applied on top of catalog pricing.

How it works: Store the tier as a metafield on the company profile. The function reads the metafield and applies the corresponding discount (e.g., Silver gets 2% off, Gold gets 5%, Platinum gets 8%). This stacks with whatever catalog pricing is already in place.

Alternative approach: You could create separate catalogs for each tier instead, which avoids the need for a Function. The Function approach is better when the discount logic is more dynamic (e.g., tier discount only applies to certain product categories or above certain order values).

Order-value-based B2B discounts

Use case: Encourage larger B2B orders by offering an additional discount when the cart exceeds a threshold (e.g., extra 3% off orders over $10,000).

How it works: The function checks that the customer has a company, calculates the cart total, and applies the discount if the threshold is met. This is a conditional discount that catalogs cannot express.

Catalogs vs. Functions: When to Use Which

Use B2B catalogs when:

  • You need to set company-specific base prices (either percentage adjustments or fixed prices)
  • You need quantity rules (minimum, maximum, increments) per company
  • You need volume pricing tiers (price breaks at specific quantities)
  • The pricing is static and tied to the company relationship, not to cart conditions or promotional logic

Use Shopify Functions (discount functions) when:

  • You need discounts that apply only to B2B customers in a blended store
  • You need discount codes restricted to B2B buyers
  • You need conditional logic (order value thresholds, product category restrictions, time-based promotions) that catalogs cannot express
  • You need company metadata (tiers, regions, contract types) to drive discount rules

Use both together when:

  • Catalogs set the base B2B price (your negotiated wholesale rate)
  • Functions layer on additional conditional discounts (promotional pricing, volume incentives, tier-based extras) that apply on top of catalog pricing

In most B2B setups, catalogs do the heavy lifting. Functions fill in the gaps where you need custom logic that catalogs do not support.

Implementation Considerations

Development requirements:

  • Shopify Functions require a Shopify app to deploy. Even if the function is for your own store, it runs within an app context.
  • Functions are written using the Shopify CLI and deployed to your store. If you do not have in-house development resources, you will need a Shopify developer or agency to build and maintain them.
  • Testing is critical. Discount functions affect pricing at checkout, and bugs can result in incorrect pricing for every order until fixed.

Performance constraints:

  • Functions have strict execution time limits (currently 5ms for most extension points). Your logic must be efficient.
  • Functions cannot make external API calls. All data the function needs must be available through Shopify's input (cart, customer, metafields). If your pricing logic depends on data from an ERP or external system, that data needs to be synced to Shopify metafields in advance.

B2B-specific constraints:

  • Shopify allows you to disable discounts for B2B orders at the store level. If you have disabled discounts for B2B, your discount function will not run for B2B customers. Make sure this setting aligns with your intended workflow.
  • Customer segmentation can also restrict discount eligibility without Functions. If your logic is simple (e.g., "this discount is only for the B2B segment"), a segment-based restriction may be enough and avoids the need for custom code.

Combining Catalogs, Functions, and Flow

The most capable B2B pricing setups use all three tools together, each handling what it does best:

  • Catalogs set the base price per company (negotiated wholesale rates, fixed prices for key products, volume tiers).
  • Functions add conditional discount logic that catalogs cannot express (B2B-only codes, order-value thresholds, tiered extras based on company metadata).
  • Shopify Flow handles the operational side: tagging orders that received a discount for reporting, notifying sales reps when a high-value discount triggers, or automating approval for orders where the combined discount exceeds a threshold.

Example scenario: A manufacturer sells industrial components on a blended Shopify Plus store.

  • Catalogs give each distributor their negotiated pricing (Distributor A gets 30% off retail, Distributor B gets 25% off retail).
  • A discount function applies an additional 3% off for any B2B order over $15,000, but only for B2B customers (D2C orders are excluded).
  • Shopify Flow flags any order where the total discount exceeds 35% for manual review before fulfillment.

This layered approach keeps each tool focused on what it handles best without overcomplicating any single piece.