Deprecated: 関数 WP_Dependencies->add_data() がバージョン 6.9.0 から非推奨になった引数付きで呼び出されました。IE の条件付きコメントは、対応しているすべてのブラウザで無視されます。 in /home/artws/woo-japan.info/public_html/wp-includes/functions.php on line 6131

Deprecated: 関数 WP_Dependencies->add_data() がバージョン 6.9.0 から非推奨になった引数付きで呼び出されました。IE の条件付きコメントは、対応しているすべてのブラウザで無視されます。 in /home/artws/woo-japan.info/public_html/wp-includes/functions.php on line 6131
コンテンツへスキップ →

development-environment

Setting up your development environment

Recommended software

WooCommerceエクステンションを開発する際に考慮する必要がある特定のソフトウェア要件がいくつかあります。必要なソフトウェアは以下の通りです:

  • Git for version control of your source code
  • Node.js and nvm to manage node-based scripts and build processes
  • Pnpm is an npm alternative required if you are building WooCommerce from the repository
  • Composer is an optional dependency management tool for PHP-based development
  • WP-CLI is the command line interface for WordPress

ほとんどのWordPressホスティング環境には、デフォルトでNodeとComposer*が含まれていないため、エクステンションやテーマを配布する場合は、ビルドされたすべてのアセットを含めることが重要です。

Note: A POSIX compliant operating system (e.g., Linux, macOS) is assumed. If you're working on a Windows machine, the recommended approach is to use WSL (available since Windows 10).

Setting up a reusable WordPress development environment

上記で紹介したソフトウェアに加えて、ローカルの開発サーバースタックをセットアップするための何らかの方法も用意したい。これにはさまざまなツールがあり、それぞれに機能や制限があります。以下の選択肢の中から、お好みのワークフローに最も適したものを選ぶことをお勧めする。

Studio – Recommended Approach

For easy local development environments, we recommend Studio, the local development environment provided by WordPress.com. Studio includes the ability to manage multiple local website environments, as well as integrations with your code editor and terminal. Studio also features a WordPress-specific AI Assistant, easy imports from WordPress backups, free public preview sites, and two-way sync with sites hosted on WordPress.com.

wp-env

wp-env is a command-line utility maintained by the WordPress community that allows you to set up and run custom WordPress environments with Docker and JSON manifests. The repository includes a .wp-env.json file specifically for contributing to WooCommerce core.

General PHP-based web stack tools

以下は、WordPressに特化したものではない、環境管理に役立つツールのコレクションです。

  • MAMP – A local server environment that can be installed on Mac or Windows.
  • WAMP – A Windows web development environment that lets you create applications with Apache2, PHP, and MySQL.
  • XAMPP – An easy-to-install Apache distribution containing MariaDB, PHP, and Perl. It's available for Windows, Linux, and OS X.
  • Laravel Herd / Valet – A minimalist and fast development environment for macOS (Valet) and Windows (Herd), optimized for Laravel and other PHP applications.
  • Lando – A powerful, Docker-based tool for defining and managing local development services across various languages and frameworks.
  • DDEV – An open-source, Docker-based tool for streamlined local web development, supporting many CMS and frameworks like Drupal and WordPress.
  • vvv is a highly configurable, cross-platform, and robust environment management tool powered by VirtualBox and Vagrant.

Minimum server requirements

Regardless of the tool you choose for managing your development environment, you should make sure it meets the server recommendations for WooCommerce as well as the requirements for running WordPress.

Add WooCommerce Core to your environment

WooCommerceを開発する場合、WooCommerce Coreの開発版をインストールするのが便利です。

Option 1: WooCommerce Beta Tester

If installing WooCommerce through the traditional WordPress dashboard, you can also install the WooCommerce Beta Tester extension to change the version, including access to upcoming betas and release candidates. The WooCommerce Beta tester is available through the Woo Marketplace.

Option 2: Clone the WooCommerce Core repository

You can also work directly against the trunk or upcoming release branch of WooCommerce Core in your development environment by:

  1. Cloning the WooCommerce Core repository.
  2. Installing and activating the required Node version and PNPM.
  3. Installing WooCommerce’s dependencies.
  4. Building WooCommerce.
  5. Symlinking the plugin/woocommerce directory to your wp-content/plugins directory

Clone the WooCommerce Core repository

以下のCLIコマンドを使ってWooCommerce Coreリポジトリをローカルにクローンできます:

cd /your/server/wp-content/plugins
git clone https://github.com/woocommerce/woocommerce.git
cd woocommerce

Install and activate Node

It is recommended to install and activate Node using Node Version Manager (or nvm). You can install nvm using the following CLI command:

nvm install

You can learn more about how to install and utilize nvm in the nvm GitHub repository.

Install dependencies

WooCommerceの依存関係をインストールするには、以下のCLIコマンドを使用します:

pnpm install --frozen-lockfile

Build WooCommerce

以下のCLIコマンドを使用して、WooCommerceの動作に必要なJavaScriptとCSSをコンパイルします:

pnpm build

注意: コンパイルされたアセットを生成せずにサーバ上でWooCommerceを実行しようとすると、エラーやその他の望ましくない副作用が発生する可能性があります。

Symlink the WooCommerce plugin

WooCommerceプラグインをローカルの開発環境にロードするには、クローンしたリポジトリにあるWooCommerceプラグインからローカルのWordPress開発環境にシンボリックリンクを作成します。

ln -s woocommerce/plugins/woocommerce /path-to-local/wp-content/plugins

Generating a woocommerce.zip asset

Alternatively, you can generate a woocommerce.zip file with the following command:

pnpm build:zip

A woocommerce.zip file may be helpful if you’d like to upload a modified version of WooCommerce to a separate test environment.