--- title: WooCommerce B2B registration with manual approval description: Wholesale on WooCommerce needs a trade application form and an approval step before prices drop. A small plugin adds both, with a flat discount. source: https://steem.dev/blog/woocommerce-b2b-registration-manual-approval published: 2026-09-08 updated: 2026-10-31 alternative_to: B2B King site: Steem — AI WordPress plugin generator --- # WooCommerce B2B registration with manual approval WooCommerce treats every registered customer the same: one customer role, the same prices for everyone, nothing at checkout that tells a retail buyer from a trade account. Adding a wholesale tier means solving three things at once: a separate way for businesses to apply, a hold on new applications until someone reviews them, and prices that only drop for accounts you have approved. WholesaleX, B2B King and similar extensions take on the whole B2B problem: per-product prices, quantity breaks, minimum orders, net payment terms and a catalogue only trade accounts can see. For a shop adding its first wholesale tier, with a flat percentage off retail and a human decision on every application, that is a lot of machinery. This build covers the core of the workflow: an application form, a pending role, an admin email with approve and decline links, and a percentage discount on WooCommerce prices. Catalogue management and per-product pricing stay with the big extensions. ## What one build covers - Front-end trade account application form via a [wholesale_registration] shortcode - wholesale_pending role holding applications until manually reviewed - Admin email notification with nonce-signed one-click approve and decline links - Automatic role change to wholesale_customer and confirmation email on approval - Site-wide percentage discount applied to WooCommerce prices for approved accounts ## What it does not cover - Per-product or per-category wholesale prices - only a single site-wide percentage - Quantity-based pricing tiers or minimum order requirements - A separate wholesale product catalogue hidden from retail visitors - Net payment terms or purchase-order payment methods - A self-service account portal for wholesale customers to manage their own details ## The prompt ```text Build a WooCommerce plugin that adds wholesale registration with manual approval. Register two custom WordPress user roles: wholesale_pending and wholesale_customer. Add a [wholesale_registration] shortcode that renders a front-end form with fields for company name, contact name, email, phone and a business description textarea. On valid form submission: if no WordPress user exists for that email, create one with the username derived from the email, assign the wholesale_pending role, store company name and business description in user meta with keys _wholesale_company and _wholesale_description, and send an email to get_option('admin_email') containing the applicant's details and two admin URLs constructed with add_query_arg and wp_nonce_url pointing to admin.php with a custom action parameter (wholesale_approve or wholesale_decline) and the user ID; then display a success message on the page. If an account already exists for that email, display an error message. Handle both admin actions in admin_init: verify the nonce, then for wholesale_approve change the user role to wholesale_customer using WP_User::set_role and send a welcome email to the user; for wholesale_decline delete the user with wp_delete_user and send a short rejection email to the applicant. Add a submenu page under the WooCommerce admin menu called Wholesale with a single settings field for wholesale_discount_percent using the Settings API, defaulting to 10. Hook into woocommerce_product_get_price and woocommerce_product_get_regular_price with priority 99 to multiply the price by (1 - discount/100) when the current user has the wholesale_customer role. Filter woocommerce_get_price_html to append a span with class wholesale-price-label and text Wholesale price for wholesale_customer users. Register all hooks inside a function attached to plugins_loaded. ``` ## WooCommerce has no idea what a trade applicant is WordPress ships customer and subscriber roles, and WooCommerce adds nothing for someone waiting on a trade decision. The usual workaround is a contact form, an inbox, a manual check on the applicant and a hand edit of their user profile. It holds up for a handful of accounts and falls apart the day the person doing approvals is away. Prices are public by default as well. You can hide a product, but nothing built in shows retail customers one price and logged-in wholesale accounts another. Role-based pricing is always a plugin's job. ## From application to approved account Put the `[wholesale_registration]` shortcode on a page of its own. The form asks for company name, contact name, email, phone and a short business description. Submitting it creates a user with the `wholesale_pending` role and stores the company name and description in user meta. If the email already belongs to an account, the form asks them to log in or use another address instead of creating a duplicate. You get an email with the applicant's details and two links, approve and decline, each signed with a nonce and handled by a custom admin action. Approve switches the role to `wholesale_customer` and sends a welcome email. Decline deletes the account and sends a short rejection. ## One percentage, everywhere a price appears WooCommerce > Wholesale has a single setting: the discount percentage, 10 by default. WooCommerce's price hooks read it whenever a logged-in `wholesale_customer` sees a price, so the shop page, product pages, cart and checkout all show the reduced figure, and the reduced figure is what gets charged. A 'Wholesale price' label makes the rate visible. Changing the percentage takes effect at once, without touching a single product. To check the whole loop, submit an application from an address you control, approve it from the email, log in as that account and look for the discount and the label. ## A first trade tier in the same catalogue It suits a shop with twenty or thirty trade accounts that wants a proper application process instead of approvals by email, and pricing that is a flat discount rather than a per-product matrix. Retail and wholesale share one catalogue. Because the discount comes off the existing retail price, you maintain one set of products and the role decides what each customer pays. It also gives a developer who inherits a store run on hand-approved trade accounts a real approve-and-decline flow without a heavyweight B2B extension. ## When a B2B extension earns its fee Different prices on individual products or categories need WholesaleX or B2B King; one site-wide percentage cannot express them. The same goes for quantity breaks, minimum order values and paying on account at the end of the month. A wholesale catalogue hidden from retail visitors is outside this build too, which assumes the only difference is price. And where wholesale is the main business rather than a second channel, a maintained extension is the better investment. A follow-up message can add a VAT number field that appears in your notification email, or a Wholesale Accounts page listing pending and approved accounts with an approve button on each row. ## Questions ### Can a declined applicant reapply? Yes. Declining deletes the account, so the email address is free again. A new application creates a fresh account and sends you another notification. --- Source: https://steem.dev/blog/woocommerce-b2b-registration-manual-approval Build this plugin: https://steem.dev/app