Goal
Review WooCommerce code with a checklist and automate the standards.
Key concepts
- WordPress Coding Standards (WPCS) through PHPCS; WooCommerce rules —
woocommerce/woocommerce-sniffs - PHPStan for types and logic errors; WordPress and WooCommerce need stubs (
szepeviktor/phpstan-wordpress,php-stubs/woocommerce-stubs) - Automation in CI on every PR, a human for architecture and business logic
- The WooCommerce checklist: CRUD instead of post meta, HPOS, both checkouts, idempotency, security, i18n, performance
- Review tone: questions and suggestions with an explanation, not orders
Diagram
flowchart LR
PR["Pull Request"] --> CI["CI: PHPCS, PHPStan,<br/>tests"]
CI -- red --> FIX["The author fixes it"]
CI -- green --> HUM["Human review:<br/>WooCommerce checklist"]
HUM --> MERGE["Merge"]
Code
phpcs.xml.dist:
<?xml version="1.0"?>
<ruleset name="My WC Extension">
<file>./src</file>
<file>./my-wc-extension.php</file>
<exclude-pattern>/vendor/*</exclude-pattern>
<rule ref="WordPress-Extra"/>
<rule ref="WooCommerce-Core"/>
<config name="minimum_supported_wp_version" value="6.5"/>
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array" value="my-wc-extension"/>
</properties>
</rule>
</ruleset>
WooCommerce review checklist
| Question | What we look for |
|---|---|
| Data | CRUD, not get_post_meta / update_post_meta for products and orders |
| HPOS | No shop_order in WP_Query and no SQL against wp_posts |
| Checkout | Works in classic and block; fields through the fields API |
| Background | External APIs in a queue, idempotent jobs |
| Security | Nonce, permissions, sanitizing, escaping, prepare |
| Performance | No queries in loops, there is a cache and pagination |
| i18n | Every string in __() with the right text domain |
| Compatibility | Feature declarations, WC tested up to |
Common mistakes
| Symptom | Cause | Fix |
|---|---|---|
| The review turns into arguments about spaces | Style isn't automated | PHPCS in CI and pre-commit |
| An HPOS bug passed the review | No WooCommerce checklist | The checklist in the PR template |
| A junior is afraid of reviews | Comments without explanations | Explain "why" and give links |
Weak and strong answer
Question: What do you look at in a code review of a WooCommerce plugin?
Weak answer. Code style and whether there are bugs.
Strong answer. CI catches style and basic errors (PHPCS, PHPStan). I look at what automation doesn't see: whether data goes through CRUD and is HPOS compatible, whether the solution works in block checkout, whether we make external requests inside the customer's request, handler security, query performance. I write comments with explanations so the review teaches, not only blocks.
Why the second is stronger: A split between automation and a human, a concrete checklist and a mentoring approach (a requirement of the job posting).
Practice
In the terminal run PHPCS and PHPStan, see why PHPStan fails without stubs, install them and run it again.
On your own plugin: set up PHPCS with WordPress-Extra and WooCommerce-Core and fix all the errors. Review the code from lesson 8.3 with the checklist and write 3 comments as if the review were for a junior.
Interview Questions
PHPCS checks style and patterns (WPCS: escaping, nonce, prepare). PHPStan is static analysis of types and logic: non-existent methods, wrong types, dead code.
The big picture first, then the details. Separate the must-haves from the nice-to-haves. Explain the reason and give links. Praise good decisions. Big changes — talk them through, not 40 comments.
Style (PHPCS), static analysis (PHPStan), tests, the JS build. The human keeps architecture, business logic and security in context.