Almost every WooCommerce store eventually needs a price to behave differently from the number typed into the product. Wholesale customers pay less. Buy ten, get a discount. One product is priced per square metre. A specific customer has an agreed rate.
The instinct is to search the plugin directory. Sometimes that is right. Often it is not, and the cost of getting it wrong is paid every month afterwards.
How WooCommerce prices actually work
WooCommerce does not treat price as a fixed value. It passes it through filters before display and again before it is added to the cart. That is the whole reason custom pricing is possible without touching core files. The two you will meet most often are woocommerce_product_get_price for what is displayed, and the cart item price hooks for what is actually charged.
This matters because a lot of half-working pricing setups change one and not the other. The customer sees £80 on the product page and £100 at checkout. That is not a plugin bug, it is a missing filter.
When a snippet is the right answer
A snippet is usually enough when the rule is small, stable and specific to your business:
- Role-based pricing. Wholesale users get 20 per cent off everything. That is a handful of lines and a user role.
- A fixed rule on one category. Everything in “Clearance” is half price while the sale runs.
- Quantity breaks on a few products. Ten or more units, price drops.
- Calculated pricing. Price equals width times height times a rate, taken from a custom field.
The advantage is not just size. A snippet does what you asked and nothing else: no settings screen, no licence renewal, no update that quietly changes the tax behaviour, no extra queries on every page load.
When you genuinely want a plugin
Buy the plugin when the rules need to be managed by someone who is not a developer, and when the number of rules will keep growing. If your sales team needs to set customer-specific pricing themselves, across hundreds of products, with start and end dates, then a proper pricing plugin with an admin interface is the correct tool. Writing that interface from scratch would cost far more than the licence.
The dividing line is roughly this: if the rule is going to change every week and someone in the office needs to change it, that is a plugin. If it is a business rule that was decided once, that is a snippet.
The things people forget
Custom pricing touches more places than most people expect. Before it is finished, all of these need checking:
- The product page, shop archive and any related-product widgets.
- Cart, checkout and order review totals.
- Order confirmation emails and the admin order screen.
- Tax calculation, especially where prices are entered inclusive of tax.
- Coupons, which can stack with custom pricing in ways nobody intended.
- Variable products, where each variation has its own price and price range display.
A pricing change that looks correct on the product page and wrong in the confirmation email is worse than no change at all, because the customer has already paid by then.
Where to keep the code
Not in the theme’s functions.php if you can help it, and never in the parent theme, which an update will overwrite. Use a child theme or a small site-specific plugin. That way the pricing logic survives a theme change and can be switched off in one place if something goes wrong.
The short version
Ask who needs to change the rule, and how often. Rarely and by a developer means a snippet. Often and by staff means a plugin with an interface. Everything else — where it hooks in, which filters it needs, what breaks in the emails — follows from that answer.
If you are not sure which side of the line your requirement falls on, describe it in a message and you will get an honest answer, including when the answer is “just buy the plugin”. More on WooCommerce development here.

Add comment