MIKHAIL NERI

Custom WooCommerce Extension

Role Based Pricing Extension

Show wholesale, retail, and VIP customers their own prices, with no change to the WooCommerce core.

Platform
WooCommerce
Stack
PHP, WooCommerce, WordPress Roles, MySQL

Context

A store served both businesses and regular shoppers and needed different prices for each. Wholesale buyers, retail customers, and VIP members each had their own rate, but the team did not want to fork WooCommerce or run a heavy membership suite to get there.

I built a small extension that hangs off WordPress user roles, so pricing stays simple and the core stays untouched.

How it works

  • Reads the signed in user role on every price calculation
  • Applies the matching price tier across the shop, product, and cart pages
  • Hooks the WooCommerce price filters instead of editing core, so updates stay safe
  • Falls back to the standard price for logged out visitors
  • An admin screen maps each role to a pricing tier

Results

  • One catalog now serves three customer types without duplicate products
  • Survived WooCommerce updates because nothing in core was touched

Lessons

I would memoize the tier lookup per request. Resolving the role and tier on every price render is cheap, but on a large cart it repeats more than it needs to, and caching it once per page would tidy that up.

Stack

  • PHP
  • WooCommerce
  • WordPress Roles
  • MySQL

Need a plugin like this?

Start a project

Custom Post Type & Taxonomy Plugin Next plugin