The complaint “the price I saw on the web came out different on the invoice” almost always comes from the same place in B2B stores: pricing rules are applied in a different order on the web and in the ERP. A dealer-group list, a discount defined on the customer account, a quantity tier and a project price can all be in effect at the same time. Since WooCommerce was designed for retail, it doesn’t cover this model out of the box; if the setup is wrong, a different amount appears in the cart, or worse, one customer’s price is shown to another from the cache. Below, we explain how we model B2B pricing in WooCommerce and which decision should be made where.
B2B pricing models
Pricing rules in corporate sales usually fall into one of these types or a combination of several:
| Model | Definition | Typical source |
|---|---|---|
| List price | The base price for everyone | ERP price list |
| Group price list | Separate lists for groups such as dealers, distributors and corporates | ERP or web |
| Account-based discount | A general or brand-based rate specific to the customer | ERP customer account |
| Tiered price | Unit price that drops as quantity increases | ERP or web |
| Contract / project price | A fixed, time-limited price for a specific product and customer | ERP or quoting system |
The order in which these rules are applied must be tied to a written precedence rule. For example, if there’s a contract price, it overrides everything else; if not, the group list is taken, the account discount is applied on top, and the tier is calculated last. This order must be exactly the same as the order of the pricing engine in the ERP. If the order is different, the amount is different. The first document we ask for when starting a project is an example calculation showing the steps by which an order’s price is generated in the ERP.
The source of the price: ERP or e-commerce
In terms of corporate web and e-commerce architecture, there are two basic paths. Either the price is calculated in the ERP and the web only shows the result, or the rules are moved to the web and WooCommerce calculates.
| Approach | Advantage | Limitation |
|---|---|---|
| Real-time ERP query | A single source of truth, same as the invoice | Every page depends on the ERP, slow |
| Transfer of a price table calculated in the ERP | Fast, same as the ERP result | The customer × product table can grow large |
| Rule transfer, the web calculates | Flexible, small data volume | Two pricing engines, risk of divergence |
If the number of products and customers is manageable, the safest path is to transfer the final prices calculated by the ERP to the web by group or account. If there are few rules but a very large number of customer × product combinations, the rules are transferred; in this case, a check job that regularly compares web and ERP results on sample orders is essential. Two pricing engines drift apart over time. A real-time ERP query is usually used only as the final verification at cart and order confirmation. For choosing the transfer method, see the ERP and web integration patterns article.
Customer group and account-based pricing
There are two common ways to carry group information in WooCommerce: a WordPress user role, or a group/account code kept in user metadata. Using the role for the price group ties permissions and price together; the model breaks the day a user needs to be both a “purchase approver” and in “dealer group A”. Keep the price group and account code in separate meta fields, and set up permissions separately as described in the B2B portal authorization architecture article. If there are several users under one account, the price is tied to the account, not the user.
The price is applied with WooCommerce’s price filters. The example below reads the group price from a transferred price table. For variable products, since WooCommerce caches price ranges in transient data, group information must be added to the cache key:
function eretek_b2b_price( $price, $product ) {
if ( $product->get_meta( '_eretek_tier_applied' ) ) { return $price; } // tier applied in the cart
$group = eretek_current_price_group(); // e.g. user meta: price_group
if ( ! $group ) { return $price; }
$p = eretek_lookup_price( $product->get_id(), $group ); // transferred price table
return ( null !== $p ) ? $p : $price;
}
add_filter( 'woocommerce_product_get_price', 'eretek_b2b_price', 20, 2 );
add_filter( 'woocommerce_product_variation_get_price', 'eretek_b2b_price', 20, 2 );
add_filter( 'woocommerce_variation_prices_price', 'eretek_b2b_price', 20, 2 ); // price range calculation
// Split the variation price range cache by group
add_filter( 'woocommerce_get_variation_prices_hash', function ( $hash ) {
$hash[] = eretek_current_price_group();
return $hash;
} );
The price lookup shouldn’t make a separate database call for each product. 48 products on a category page means 48 queries. Fetch the prices of the products on the listing page in a single query, or keep them by group in a persistent object cache (such as Redis). If sale price display is wanted, the regular and sale price filters must be handled with the same logic; otherwise the struck-through price appears wrong.
Tiered pricing and minimum orders
In tiered pricing, the unit price is determined by the quantity in the cart. The tier table is shown on the product page, and it’s applied in the cart calculation. In WooCommerce, the place for this is the woocommerce_before_calculate_totals action:
add_action( 'woocommerce_before_calculate_totals', function ( $cart ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { return; }
foreach ( $cart->get_cart() as $item ) {
$tier = eretek_tier_price( $item['product_id'], $item['quantity'] );
if ( null !== $tier ) {
$item['data']->set_price( $tier );
$item['data']->update_meta_data( '_eretek_tier_applied', 1 ); // in memory only, not saved
}
}
}, 20 );
Two decisions must be clear in the tier calculation: will the tier look only at the quantity of the same product, or at the total of the same product family (e.g. all color variations); and will the tier price be applied on top of the group price or replace it. These decisions must match their equivalent in the ERP. There’s also a trap that’s often caught in the field: if the woocommerce_product_get_price filter is active, the tier price written with set_price() in the cart is overwritten again with the group price by the filter when it’s read. The flag in the example prevents this conflict. If the tier function is to use the group price as its base, the calculation should be done inside that function.
Other common constraints in B2B:
- Minimum order amount: If the cart total is below the threshold, the checkout step is blocked and the user is shown the missing amount. The check can be done in the
woocommerce_check_cart_itemsaction by adding an error withwc_add_notice(). - Case quantity: If a product is only sold in packaging quantities such as multiples of 12, the step of the quantity field and the cart validation are set accordingly. Changing the step in the interface alone isn’t enough; validation must also be done on the server side.
- Group-based payment method: Open account or bank transfer is shown only to approved accounts.
VAT display and the quote flow
Corporate buyers usually consider prices excluding VAT, while retail customers expect to see them including VAT. In WooCommerce, the “Display prices in the shop” and “Display prices during cart and checkout” options under Settings → Tax determine this behavior; the values are stored as incl or excl in the woocommerce_tax_display_shop and woocommerce_tax_display_cart options. In a mixed store, it’s possible to change these values by user group with a filter; but test that the same rule applies in the product page, cart, email and PDF quote output. The email template is usually forgotten.
If the format in which prices are entered (the “Prices entered with tax” option) differs from the display format, WooCommerce converts them and rounding differences at the cent level can appear. If the price coming from the ERP excludes VAT, the store should also be set up for entry excluding VAT. Since there are several VAT rates in Türkiye, the rates must be mapped to tax classes per product and updated together with the ERP when rates change; verify current rates against official legislation.
When the price isn’t finalized on the web, a quote flow is used: the customer submits the cart as a quote request, the sales team sets the price in the ERP or on the quote screen, and the approved quote becomes an order in the customer’s account with time-limited, locked prices. The quote price’s validity date and the quantity it was given for should be stored in the order record; when an objection comes months later, that’s the only place to look.
Cache and performance effects
Customer-specific pricing breaks the basic assumption of the page cache: “everyone sees the same HTML.” This assumption doesn’t hold in B2B. For a safe setup:
- For logged-in users, full-page and CDN caching should be turned off, or the cache key should be split to include the price group. If there are few groups, a separate cache variant per group can be used; with account-based pricing this isn’t practical.
- Listing pages shown to visitors who aren’t logged in can stay cached; after login, prices are generated on the server side.
- Verify that responses aren’t cached for parts loaded via AJAX, such as product lists, the mini cart and “similar products”.
- A persistent object cache speeds up price table queries; the key must include the group or account code and be cleared after a price transfer.
Typical examples of data leaking to the wrong user in cache layers are in the WooCommerce cache errors guide. The verification sequence is simple: open the same product, category and cart pages in private windows with test users from two different price groups, and compare the cache status in the response headers and the prices displayed. A test with a single user proves nothing.
For the pricing and permission setup in dealer and customer portals, see the B2B dealer and customer portals page; for ERP price transfer, see the ERP, CRM and API integrations page.
Frequently asked questions
A plugin or custom development for B2B pricing?
If group-based list prices and simple tiers are enough, a mature plugin does the job. In setups where the price is calculated in the ERP and there are account-based discounts and contract prices, a custom pricing layer compatible with the ERP transfer usually gives more predictable results.
How often should prices be transferred from the ERP?
It depends on how often prices change. In most B2B setups, a change-triggered or daily batch transfer is enough. For prices that change frequently with exchange rates, increase the transfer frequency and verify the latest price from the ERP at cart confirmation.
Should prices be shown to visitors who aren’t logged in?
This is a business decision. If they are shown, the list price is shown and can be served from cache. If they are hidden, the price must be removed not only from the display but also from the page source and structured data.
Does showing prices excluding VAT cause problems in the cart?
Not if it’s set up correctly. The price entry format must be the same as the ERP’s, products must be assigned to the correct tax classes, and it must be tested that the same display rule applies in the store, cart and email output.