Problem:
B2B customers needed a dedicated ordering experience with their actual dealer pricing, real inventory, and the ability to place bulk orders. The standard Shopify storefront could not provide this, and wholesale apps came with significant monthly cost and limited control over how things worked.
Solution:
A complete B2B system built in house: access controlled dashboard shells, ordering portals with live pricing from Cloudflare Workers, a wholesale pricing engine that runs across every price surface in the theme, and Shopify Functions that enforce checkout rules by buyer type.
How it works:
Access control uses native Shopify B2B company detection with a customer tag fallback for existing trade accounts, so no account loses access during the transition. The ordering portal fetches live dealer pricing and real inventory from custom Cloudflare Workers, supports CSV import and export for bulk quantity entry, and sends all selected lines directly to the native cart drawer. The wholesale pricing engine runs through every price surface in the theme, from the product page and collection cards to the cart and Open Graph tags, using a shared Liquid discount pipeline and a JS price patch in the browser so no surface is missed. Two Shopify Functions compiled to WebAssembly enforce checkout rules that Shopify's settings cannot express natively: one blocks regular buyers from purchasing backordered items while letting B2B dealers through on the same product, and another hides shipping rates that do not apply based on who is buying and what is in the cart. Both functions read their configuration from shop Metafields so rules update without touching code.
Tools: