woocommerce
woocommerce copied to clipboard
Add `wc com connect` command
All Submissions:
- [x] Have you followed the WooCommerce Contributing guideline?
- [x] Does your code follow the WordPress' coding standards?
- [x] Have you checked to ensure there aren't other open Pull Requests for the same update/change?
Changes proposed in this Pull Request:
PR adds wc com connect
command which allows stores to be connected to WCCOM via CLI script
Closes https://github.com/Automattic/woocommerce.com/issues/13888.
How to test the changes in this Pull Request:
- Generate an application password following instructions from https://github.com/Automattic/woocommerce.com/pull/13974. Save the password for later use
- From your tes site, be sure you're connecting to a local instance of 'woocommerce.com' using
woocommerce_helper_api_base
filter
add_filter( 'woocommerce_helper_api_base', function () {
return 'https://woocommerce.test/wp-json/helper/1.0';
} );
-
From the terminal, run:
wc com connect
-
When asked, past the application password from step 1.
-
Site should be connected now.
-
Run
wc com connect
again, see an error message when the site is already connected -
Run
wc com connect --force
, check that site is disconnected and connected again -
Run
wc com connect --password=APPLICATION_PASSWORD --force
, password shouldn't be prompt
Other information:
- [x] Have you added an explanation of what your changes do and why you'd like us to include them?
- [ ] Have you written new tests for your changes, as applicable?
- [x] Have you successfully run tests with your changes locally?
- [x] Have you created a changelog file for each project being changed, ie
pnpm changelog add --filter=<project>
?
FOR PR REVIEWER ONLY:
- [ ] I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.
Test Results Summary
Commit SHA: 423dd78f3e9e4d6d0cbb2c44f6d49bfe81aaa254Test :test_tube: | Passed :white_check_mark: | Failed :rotating_light: | Broken :construction: | Skipped :next_track_button: | Unknown :grey_question: | Total :bar_chart: | Duration :stopwatch: |
---|---|---|---|---|---|---|---|
API Tests | 115 | 0 | 0 | 2 | 0 | 117 | 0m 37s |
E2E Tests | 186 | 0 | 0 | 1 | 0 | 187 | 14m 29s |
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.
I'm having trouble testing this. What I did:
- Add the woocommerce.com repo as a remote in my local WooCommerce repo, fetch
- Switch to branch
add/13762-connect-endpoint-for-wc-connect-cli-command
, tracking the same remote branch (for doing the testing instructions in 13885-gh-Automattic/woocommerce.com) - Run the command to create the tables from that pr, then I get
'wccom' is not a registered wp command
Am I missing something?
@rcstr I've left a few comments.
Also in order to make the command easier to be used by automated scripts, I think we should allow passing the password as an argument to the connect command.
thanks @thilinah for the suggestion, I have added the --password
flag, and another flag to --force
in 423dd78
I'm having trouble testing this. What I did:
- Add the woocommerce.com repo as a remote in my local WooCommerce repo, fetch
- Switch to branch
add/13762-connect-endpoint-for-wc-connect-cli-command
, tracking the same remote branch (for doing the testing instructions in 13885-gh-Automattic/woocommerce.com)- Run the command to create the tables from that pr, then I get
'wccom' is not a registered wp command
Am I missing something?
@Konamiman, everything looks good from the instructions you followed. Could you try running npm run wp:cli -- wccom create-app-passwords-tables
? This will run the command from the docker-machine
@rcstr I tried what you suggested and I'm getting a Error response from daemon: Container (guid of woocommercecom_wp) is restarting, wait until the container is running
. If I take a look at the logs (docker logs
) I see the following repeated multiple times:
AH00526: Syntax error on line 32 of /etc/apache2/sites-enabled/default-ssl.conf:
SSLCertificateFile: file '/etc/ssl/certs/woocommerce.test.crt' does not exist or is empty
Do I need any additional setup?
Hi @Konamiman, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:
- [ ] Add the
release: add testing instructions
label