Building a custom WooCommerce extension
When a specific business rule has no equivalent among existing WooCommerce extensions, the lasting fix isn’t to edit the plugin or theme files directly, but to write a dedicated extension that hooks into the extension points WooCommerce provides.
Why an extension rather than a direct edit
WooCommerce, like WordPress, runs on a system of actions and filters (add_action, add_filter) that let you step in at precise points in the lifecycle of an order, a product or the cart without touching the plugin’s own files. Hooks like woocommerce_checkout_process, woocommerce_order_status_changed or woocommerce_product_get_price cover most business needs, from conditional price calculations to validating custom fields at checkout.
Editing WooCommerce files directly, or a poorly structured child theme, falls into the same trap as a badly managed PrestaShop override: the change disappears at the next update, or worse, blocks the update itself. An extension packaged in its own plugin folder survives WooCommerce and WordPress updates as long as the hooks it uses stay stable.
When the need goes beyond what native hooks allow, I sometimes expose a custom REST API route to talk to an external system (ERP, till, management tool), rather than multiplying direct database calls from another tool.
What triggers this kind of request
- A pricing or discount rule specific to your business, missing from marketplace extensions
- A sync between WooCommerce and an ERP, a till or a stock management tool
- Extra order or customer account fields with their own business logic
- Changes currently made in theme or plugin files, lost at every update
- A need for automation triggered by an order status change
How I build an extension
-
Scoping the need
I clarify exactly what the extension needs to do, with which screens, which data and which interactions with the existing setup.
-
Choosing the hooks
I identify the right actions and filters to step in at the right moment without duplicating logic WooCommerce already handles.
-
Isolated development
The code is built in its own plugin, independent of the theme, to stay stable even if the theme changes later.
-
Testing and documentation
I test on a staging environment and leave short documentation on how it works and how to configure it.
Worth reading next
-
Custom development
The framework I work within on a bespoke plugin.
-
Checking plugins before an update
The version discipline a bespoke plugin imposes on you.
-
Plugin conflicts after an update
The most common symptom of a stack of plugins piling up.
-
Creating a WordPress child theme
When the customisation belongs to the theme rather than a plugin.
-
ChatGPT Ads extension for WooCommerce
OpenAI pixel and Conversions API, compatible with HPOS, the block checkout and consent plugins: built and installed by me.
Making a plugin operable by an AI assistant
Describe your need in one minute
A few targeted questions so I can reply with an estimate rather than another questionnaire.