Hi.
I’m trying to add woocommerce support to my sage 10 theme following this guide GitHub - generoi/sage-woocommerce.
I installed the wp cli and generoi/sage-woocommerce but when trying to run any wp acorn command I get the Error: Error establishing a database connection. Any ideas what can be wrong and please ask for more details if needed.
Best regards,
Mads
From which folder are you executing the wp commands?
Anyway, those commands are used to copy two files ( single-product.blade.php
, and archive-product.blade.php
) from the vendor folder, that you can copy them manually.
The other command is used to copy a file to setup some hooks that you can copy too.
So no need to use wp cli at all.
BTW, are you sure your site is connected to the database locally? Are you using Vagrant?
Thank you for getting back to me @carlosfaria .
I’m executing the wp commands from the theme folder.
I will try just copying the files.
By site is connected to the database yes. Running mamp with localhost and I can view the site and edit etc.
I’m not using Vagrant, no.
It sounds like you might no have WP-CLI set up correctly, might be worth taking a look at this.
WP-CLI does require a bit of setup if you haven’t used it before. Local by Flywheel will set it up automatically if you switched to that – you can just open the site shell.
Alternatively, I use WP-CLI Valet which is a really quick way of setting up sites, and makes running WP-CLI commands easy. It’s worth noting that WP-CLI Valet will spin up sites in HTTPS which needs to be turned off in the config to work with sage dev links.