23 November 2026 · 7 min read · Modvanta team

Magento 2 Extension Development: Specify, Test, Maintain

A practical guide to Magento 2 extension development: how to write a spec a developer can quote, what to test before go-live, and how to keep it working.

Business article illustration

A common story goes like this. A store runs well on Magento 2 for a couple of years. Then the business wants something the core platform doesn't do: tiered shipping rules for one region, a B2B price list that depends on the customer group and the order quantity, or a nightly stock sync from the warehouse system. Someone writes a three-line email to a freelancer, gets a price, and six weeks later there's a module in app/code that works on the developer's laptop and breaks checkout the first Friday after launch.

The code usually isn't the main problem. The spec was too thin, nobody tested the edge cases, and nobody planned for the next Magento upgrade.

We write Magento 2 extensions for a living, alongside our Odoo work. Here's how we'd tell a business owner or operations manager to approach a custom extension so it costs what was quoted and keeps working after the next upgrade.

Start with a spec a developer can actually price

A good spec doesn't need to be long, but it does need to answer the questions a developer will otherwise guess at. When we get a request, these are the things we ask about first:

  • Where it shows up. Admin only, storefront, checkout, emails, the REST or GraphQL API? A feature that touches checkout is a different job from one that adds a column to the order grid.
  • Which store views and websites. Multi-store setups catch people out. If you sell in two currencies or two languages, say so, and say whether the rule applies to all of them.
  • Who changes the settings. Should the marketing team be able to edit the values under Stores > Configuration, or are they fixed in code? Configurable settings take longer to build but save you a developer call every time a number changes.
  • What happens when it fails. If the warehouse API is down, does the order still go through? Does someone get an email? A retry queue? This one question changes the estimate more than any other.
  • Your exact versions. Magento Open Source or Adobe Commerce, the 2.4.x version, the PHP version, and the list of third-party extensions already installed. Conflicts with other extensions are the most common cause of strange bugs we see.

Write the spec as examples, not adjectives. "Fast shipping calculation" means nothing. "A cart with 3 items to a postcode in zone B, total weight 12 kg, shows two rates: Standard at the table price and Express at table price plus the surcharge in config" is something a developer can build and a tester can check.

If you have screenshots of what you want the admin screen to look like, even rough sketches, send them. They cut a lot of back and forth.

How the extension should be built

You don't need to read PHP to ask the right questions about structure. A few things separate an extension that survives upgrades from one that doesn't.

It should be a proper module. It lives in its own folder with registration.php, etc/module.xml and a composer.json that states which Magento and PHP versions it supports. That makes it installable and removable cleanly, and it means your next developer can find it.

It should change core behaviour through plugins and observers, not by editing core files. Magento gives you plugins (before, after and around methods) and event observers so you can add behaviour without touching vendor code. Preferences, which swap out a whole core class, are sometimes necessary but they're the first thing to break when two extensions want the same class. If your developer uses a lot of preferences, ask why.

Database changes should use declarative schema. That means a db_schema.xml file and a whitelist, rather than old-style install scripts. It makes upgrades and rollbacks much more predictable.

It should follow the Magento coding standard. Adobe publishes a PHP_CodeSniffer ruleset for Magento 2. Running it doesn't prove the code is good, but code that fails it badly usually has other problems too. We write to Adobe coding standards on our Magento 2 and Adobe Commerce extension work, and we'd expect anyone you hire to be able to show a clean report.

One opinion we hold firmly: keep business rules out of templates. If the logic for "who sees this price" lives in a .phtml file, it'll be duplicated in the API, the email and the PDF invoice, and they'll drift apart.

Testing before it goes anywhere near production

Most of the trouble we get called in to fix comes from extensions that were tested once, by the person who wrote them, on a clean install with sample data. Your store isn't a clean install.

Here's the order we work in:

  1. Automated tests for the logic. Unit tests for price calculations, rule matching and data mapping. Integration tests for anything that saves to the database or hooks into the order flow. These run every time the code changes, so a fix in one place doesn't quietly break another.
  2. A staging copy of your real store. Same Magento version, same extensions, a recent anonymised copy of your catalogue and customers. Run bin/magento setup:upgrade, setup:di:compile and setup:static-content:deploy in production mode, the way your live server does. Plenty of extensions work in developer mode and fail on compile.
  3. Your examples from the spec, done by hand. This is where the example-driven spec pays off. Someone on your side walks through each case and ticks it off. If the result differs from the spec, either the code or the spec is wrong, and you want to find out which before customers do.
  4. The awkward cases. Guest checkout and logged-in checkout. A coupon applied. A product with no weight. An order placed from the admin. A refund through a credit memo. A customer switching store view mid-session. These are the paths that break.
  5. Performance under a realistic load. An observer on sales_order_place_after that calls an external API synchronously will slow every order. Check page and checkout times before and after the module is enabled.

If the extension touches tax calculation or invoicing, test it against the tax settings for every country you sell into, and get your accountant to look at sample invoices. Tax rules change and vary a lot between countries, so confirm the treatment with a local accountant or the tax authority rather than relying on the developer's assumptions.

Maintenance is part of the price

A custom extension isn't finished when it goes live. Adobe releases security patches and minor versions on a regular cycle, PHP versions reach end of life, and the third-party modules around yours get updated too. Every one of those can break something.

What we'd plan for:

  • Source control you own. The code should sit in your Git repository, not only on the developer's machine or the live server.
  • A short README in the module. What it does, where its settings are, which events and plugins it uses, what cron jobs it adds. Ten minutes to write, hours saved later.
  • A check after each Magento upgrade. Run the automated tests, run the compile, walk the key examples on staging. If the tests from the build phase exist, this is quick.
  • Logs that someone reads. A custom log file under var/log for the extension's errors, plus an alert if, say, the sync hasn't run in 24 hours.

Budget a small amount of time each year for this. It's far cheaper than an emergency fix during a sale.

When the extension talks to Odoo

A lot of the extensions we build connect Magento to an ERP, often Odoo: orders flowing into Odoo Sales, stock levels coming back from Inventory, invoices and payments reconciled in Accounting. The same rules apply, with two extras. Decide which system owns each piece of data (usually Magento owns the cart and Odoo owns stock and accounting), and decide what happens when a record exists on one side but not the other. We cover Magento to Odoo integration as part of our development services, and if you're on the Odoo side already, our Odoo apps might cover part of what you need without custom code.

Questions we get asked

Can't we just buy an extension from the marketplace?

Often, yes, and you should check first. A well-maintained marketplace extension is cheaper than custom work. Custom makes sense when the rule is specific to your business, when three marketplace modules would need to be glued together, or when the existing ones conflict with what you already run.

How long does a typical custom extension take?

It depends almost entirely on the spec. An admin grid column or a config-driven display rule is days. Something that changes checkout or syncs with another system is weeks. A clear spec with examples is the fastest way to get a firm number.

Will it survive upgrading to the next Magento version?

If it's built as a proper module, uses plugins rather than core edits, and has tests, upgrades are usually small jobs. If it was written by editing core files, expect trouble.

Talk to us

If you have a Magento 2 extension in mind, send us what you have, even rough notes, and we'll come back with a written price and timeline within one working day. You can request a quote or contact us; we work remotely with teams in any country.