Setup and develop the WooCommerce block email editor. Use when working on email templates, transactional emails, or the email editor feature.
This skill provides guidance for developing the WooCommerce block email editor.
Invoke this skill when:
pnpm --filter=@woocommerce/plugin-woocommerce -- wp-env start
Site runs at http://localhost:8888 by default. If port 8888 is unavailable, wp-env assigns a different port. Check the startup output or run wp-env info to see your actual URL.
Watches and builds admin JS files (including the email editor JS package) and syncs Email Editor PHP package changes:
pnpm --filter=@woocommerce/plugin-woocommerce watch:build:admin
Visit http://localhost:8888/wp-admin/admin.php?page=wc-settings&tab=advanced§ion=features and enable the block email editor.
To test email sending locally, use Mailpit as a local SMTP server.
Add to plugins/woocommerce/.wp-env.override.json:
{
"lifecycleScripts": {
"afterStart": "./tests/e2e-pw/bin/test-env-setup.sh && wp-env run cli wp plugin install wp-mail-smtp --activate"
},
"config": {
"WPMS_ON": true,
"WPMS_MAILER": "smtp",
"WPMS_SMTP_HOST": "host.docker.internal",
"WPMS_SMTP_PORT": "1025",
"WPMS_SMTP_AUTH": false,
"WPMS_SMTP_SECURE": ""
}
}
docker run --rm --name=mailpit -p 1025:1025 -p 8025:8025 -d axllent/mailpit
Or if the container already exists:
docker start mailpit
Open http://localhost:8025 to see captured emails.
After creating or modifying .wp-env.override.json, restart the environment:
pnpm --filter=@woocommerce/plugin-woocommerce -- wp-env start --update
| Path | Description |
|---|---|
packages/php/email-editor/ | Email Editor PHP package |
packages/js/email-editor/ | Email Editor JS package |
plugins/woocommerce/.wp-env.override.json | Local wp-env config (gitignored) |
To rebuild the JS package after changes:
pnpm --filter=@woocommerce/email-editor build
Run tests from the packages/php/email-editor/ directory.
cd packages/php/email-editor
wp-env start
composer dump-autoload
wp-env run tests-cli --env-cwd=wp-content/plugins/email-editor ./vendor/bin/phpunit --configuration phpunit-integration.xml.dist
wp-env run tests-cli --env-cwd=wp-content/plugins/email-editor ./vendor/bin/phpunit --configuration phpunit-integration.xml.dist --filter Table_Test
Run from the packages/php/email-editor/ directory.
cd tasks/phpstan && ./run-phpstan.sh
For PHP 7 compatibility:
cd tasks/phpstan && ./run-phpstan.sh php7
composer run phpcs