Skip to content

How to set up WooCommerce development environment

Christopher Allford edited this page Apr 18, 2023 · 44 revisions

This page will guide you through the process of setting up WooCommerce development environment on your local machine. It should work on Linux, macOS, or Windows 10 with the Linux Subsystem.

Table of Contents

Getting Started

Please check out our getting started guide for information about prerequisites and initial setup.

Development Information

We also have more in-depth documentation on how to develop in our repository. This also includes information about how to set up the development environment.

Troubleshooting

Build Out-of-memory Error

Note: Depending on your PHP settings, you may encounter an out-of-memory error similar to the following...

> wp i18n make-pot . --exclude=".github,.wordpress-org,bin,sample-data,node_modules,tests" --slug=woocommerce '--skip-audit'
Plugin file detected.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 67108872 bytes) in /Users/exampleuser/vagrant-local/www/woocommerce-dev/public_html/wp-content/plugins/woocommerce/vendor/mck89/peast/lib/Peast/Syntax/Utils.php on line 37

If this happens, increase the memory_limit setting in your php.ini configuration file and re-run pnpm nx build woocommerce.

Alternatively, you might encounter 'Maximum function nesting level reached' error from xDebug. In that case, disable xDebug in your PHP installation temporarily.

Debugging

Using Xdebug in the wp-env environment

Please refer to WP-ENV official README section for setting up Xdebug.

Debugging synced lookup information:

To debug synced lookup information in the database, you can bypass the action scheduler and immediately sync order and customer information by using the woocommerce_analytics_disable_action_scheduling hook.

add_filter( 'woocommerce_analytics_disable_action_scheduling', '__return_true' );

Using debug package.

Currently, the debug package is utilized to provide additional debugging for various systems. This tool outputs additional debugging information in the browser console when it is activated.

To activate, open up your browser console and add this:

localStorage.setItem( 'debug', 'wc-admin:*' );

WooCommerce Admin Test Helper

WooCommerce Admin Test Helper is a plugin that makes it easier to test the WooCommerce Admin plugin.

IDE integrations

WooCommerce core has linting rules in place via pre-commit hooks to ensure code standards are used. Ensure you have installed NPM and Composer packages, so these are set up!

While developing, we recommend adding support to your editor for the following (most IDEs have plugins for this):

Additional resources

  1. Running unit tests
  2. Running Puppeteer E2E tests (deprecated)
  3. Running Playwright E2E tests (recommended)
  4. Extra VVV configurations
Clone this wiki locally