Installing plugins using composer

I am using Bedrock/Sage 9 (no Trellis) and having an issue installing plugins via the composer require command. I know I can add them manually into the composer.json but trying to avoid that if possible (sorry, still coming up to speed with Composer). The command I am using is:

composer require automattic/woocommerce

The result is:

Problem is that when I run composer install I get Nothing to install or update. Any advice on what I am missing would be helpful.

tl;dr

You are doing it correctly. automattic/woocommerce is being installed during $ composer require. No $ composer install required.

$ composer require

Add packages to composer.json plus perform $ composer install

$ composer install

if composer.lock exisit, install packages according to composer.lock versions
if composer.lock not exisit, run $ composer update to generate composer.lock plus install packages according to composer.lock versions

$ composer update

(Re-)Generate composer.lock according to version constraints defined in composer.json then install packages according to composer.lock versions.

Note: automattic/woocommerce & wpackagist-plugin/woocommerce are 2 different packages. Make sure installing automattic/woocommerce is what you inteneded.

2 Likes

No idea why but the wpackagist woo couldn’t be found so I switched to the Packagist option. This was wrong. I just removed it and then used the other and now all is working correctly. Who knows…thank you for the reply!

By the way: When the composer package type is not wordpress-plugin it is not installed into the plugin folder and WordPress can’t find it as a plugin, it would be still “installed” by composer, hence it will notice that there is nothing to be installed in subsequent compoaer install invocations.

Yes, I realized that when looking in the composer file. Once I used wpackagist-plugin, everything went well. Still don’t know what went wrong yesterday when I tried it but it’s all working perfect now. Thanks for the reply!

This topic was automatically closed after 42 days. New replies are no longer allowed.