Search articles

A B2B System Built Around WooCommerce

Case study: custom theme and plugin on WooCommerce for wholesale, per-account discounts, field quotes, and role-based access policy.

Case studies, E-commerce

by Leonidas Michalopoulos 3 min read

B2B WooCommerce platform — case study cover

Overview

The business needed a single digital storefront that works as a public catalogue, hides wholesale prices until partners are approved, applies per-account discounts, and supports sales through a structured quote workflow.

The solution is an extension of WordPress and WooCommerce: a theme that encodes B2B rules and a plugin that implements the quote lifecycle on top of WooCommerce’s catalogue and user model. The architecture emphasises separation of presentation, domain policy, and platform, within the constraints of a mature CMS/e‑commerce installation.

Diagram:

B2B WooCommerce platform architecture diagram

Context and constraints

Category Description
Business model Wholesale (B2B), partner registration and management, different access rights per role, and personalised pricing per customer.
Technology stack WordPress and WooCommerce, with external services.
Market requirements Adaptation to the Greek market, VAT ID capture on quotes, and recycling-fee calculation for products subject to the relevant obligation.
Technical approach and constraints WooCommerce remains the central system for product catalogue management and order checkout.

Partners must not see price lists before approval; B2B accounts buy at personalised prices; external representatives see prices in a controlled way; managers and sales reps can create detailed multi-product quotes with different discount tiers.

High-level architecture

The implementation follows a layered architecture, using WordPress extension hooks to add and adapt behaviour:

  1. Presentation and UX layer: Storefront templates (product and catalogue pages), partner registration flow, and a dedicated commercial quote management page.

  2. Business logic: Implemented in theme and plugin files. Includes product visibility control, pricing, shipping and payment method wiring, and quote creation and management.

  3. Core platform: WordPress and WooCommerce provide user, role, and permission management, plus asynchronous communication (AJAX). Advanced Custom Fields is used for extra fields and data.

  4. Data storage: The MySQL database hosts WooCommerce tables, custom quote management tables, and user meta related to discount policy.

Integration between components happens mainly through WordPress and WooCommerce extension mechanisms (actions and filters). This approach offers flexibility and room to extend.

┌─────────────────────────────────────────────────────────────┐
│  Channels: visitors · B2B · representatives · administrators │
└────────────────────────────┬────────────────────────────────┘
                             │
┌────────────────────────────▼────────────────────────────────┐
│  WP Theme (templates, assets, shortcodes)                   │
└────────────────────────────┬────────────────────────────────┘
                             │
┌────────────────────────────▼────────────────────────────────┐
│  Domain: b2b_logic · user_discounts · shipping · plugin     │
└────────────────────────────┬────────────────────────────────┘
                             │
┌────────────────────────────▼────────────────────────────────┐
│  WooCommerce + WordPress core + ACF                         │
└────────────────────────────┬────────────────────────────────┘
                             │
┌────────────────────────────▼────────────────────────────────┐
│  MySQL (WC + plugin + usermeta)                             │
└─────────────────────────────────────────────────────────────┘

Identity, access, and commercial policy

Role model

Role Catalogue prices Cart Deal builder Admin
Visitor Hidden No No No
b2b Yes (discounted) Yes No No
b2b2 Yes (view only) No No No
esd_external_sales_rep Yes (view only) No Yes Limited WP admin
Shop manager / administrator Full Full Yes Full

Per-account pricing

Discounts are stored in user meta (discount) and applied with WooCommerce price filters.

Checkout and fulfilment

shipping.php filters payment gateways by shipping method (pickup, courier, freight, Attica).

Recycling fees are calculated in woocommerce_cart_calculate_fees from the ACF environmental_fee field per product.

Storefront engineering

The theme organises logic in custom-functions/ and blocks in components/. Product v2 modernises the product page with a B2B-aware UI.

prices-toggler.php provides show/hide prices for privileged roles (localStorage, MutationObserver for AJAX catalogue).

Data model

Quote core fields: Quote status, buyer details, VAT ID, applied discounts, ID of the user who created the quote (created_by), and optional link to a WooCommerce order (wc_order_id).

Quote line items: Product and variation IDs, SKUs, quantities, and prices. Data is partly denormalised to simplify reporting and preserve commercial details per quote.

User meta: Stores the discount percentage for each wholesale (B2B) partner.

WooCommerce data: Central management of the product catalogue, orders, and stock availability.

Conclusion

B2B rules are expressed as explicit modules and a plugin-shaped bounded context, while WooCommerce keeps catalogue and order flow. The result enforces who sees prices, who can buy, and how field quotes enter the organisation, without sacrificing maintainability on a WordPress installation.

  • woocommerce
  • b2b
  • wordpress
  • case-study