Merge branch 'trunk' into update/tt2-view-products-button-padding
This commit is contained in:
commit
93b6f1b8ce
|
@ -0,0 +1,15 @@
|
|||
* text=auto
|
||||
|
||||
# Force LF In Configuration Files
|
||||
*.md text eol=lf
|
||||
*.json text eol=lf
|
||||
*.yml text eol=lf
|
||||
|
||||
# Force LF In Code Files
|
||||
*.php text eol=lf
|
||||
*.js text eol=lf
|
||||
*.jsx text eol=lf
|
||||
*.ts text eol=lf
|
||||
*.tsx text eol=lf
|
||||
*.css text eol=lf
|
||||
*.scss text eol=lf
|
|
@ -7,11 +7,11 @@ There are many ways to contribute to the project!
|
|||
- [Translating strings into your language](https://github.com/woocommerce/woocommerce/wiki/Translating-WooCommerce).
|
||||
- Answering questions on the various WooCommerce communities like the [WP.org support forums](https://wordpress.org/support/plugin/woocommerce/).
|
||||
- Testing open [issues](https://github.com/woocommerce/woocommerce/issues) or [pull requests](https://github.com/woocommerce/woocommerce/pulls) and sharing your findings in a comment.
|
||||
- Testing WooCommerce beta versions and release candidates. Those are announced in the [WooCommerce development blog](https://woocommerce.wordpress.com/).
|
||||
- Testing WooCommerce beta versions and release candidates. Those are announced in the [WooCommerce development blog](https://developer.woocommerce.com/blog/).
|
||||
- Submitting fixes, improvements, and enhancements.
|
||||
- To disclose a security issue to our team, [please submit a report via HackerOne](https://hackerone.com/automattic/).
|
||||
|
||||
If you wish to contribute code, please read the information in the sections below. Then [fork](https://help.github.com/articles/fork-a-repo/) WooCommerce, commit your changes, and [submit a pull request](https://help.github.com/articles/using-pull-requests/) 🎉
|
||||
If you wish to contribute code, please read the information in the sections below. Then [fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) WooCommerce, commit your changes, and [submit a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) 🎉
|
||||
|
||||
We use the `good first issue` label to mark issues that are suitable for new contributors. You can find all the issues with this label [here](https://github.com/woocommerce/woocommerce/issues?q=is%3Aopen+is%3Aissue+label%3A%22type%3A+good+first+issue%22).
|
||||
|
||||
|
@ -21,6 +21,8 @@ If you have questions about the process to contribute code or want to discuss de
|
|||
|
||||
## Getting started
|
||||
|
||||
Please take a moment to review the [project readme](https://github.com/woocommerce/woocommerce/blob/trunk/README.md) and our [development notes](https://github.com/woocommerce/woocommerce/blob/trunk/DEVELOPMENT.md), which cover the basics needed to start working on this project. You may also be interested in the following resources:
|
||||
|
||||
- [How to set up WooCommerce development environment](https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment)
|
||||
- [Git Flow](https://github.com/woocommerce/woocommerce/wiki/WooCommerce-Git-Flow)
|
||||
- [Minification of SCSS and JS](https://github.com/woocommerce/woocommerce/wiki/Minification-of-SCSS-and-JS)
|
||||
|
@ -31,24 +33,22 @@ If you have questions about the process to contribute code or want to discuss de
|
|||
|
||||
## Coding Guidelines and Development 🛠
|
||||
|
||||
- Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/)
|
||||
- Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/).
|
||||
- Run our build process described in the document on [how to set up WooCommerce development environment](https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment), it will install our pre-commit hook, code sniffs, dependencies, and more.
|
||||
- Whenever possible please fix pre-existing code standards errors in the files that you change. It is ok to skip that for larger files or complex fixes.
|
||||
- Before pushing commits to GitHub, check your code against our code standards. For PHP code in the WooCommerce Core project you can do this by running `pnpm --filter=woocommerce run lint:php:changes:branch`.
|
||||
- Whenever possible, please fix pre-existing code standards errors in code that you change.
|
||||
- Ensure you use LF line endings in your code editor. Use [EditorConfig](http://editorconfig.org/) if your editor supports it so that indentation, line endings and other settings are auto configured.
|
||||
- When committing, reference your issue number (#1234) and include a note about the fix.
|
||||
- Ensure that your code supports the minimum supported versions of PHP and WordPress; this is shown at the top of the `readme.txt` file.
|
||||
- Push the changes to your fork and submit a pull request on the trunk branch of the WooCommerce repository.
|
||||
- Make sure to write good and detailed commit messages (see [this post](https://chris.beams.io/posts/git-commit/) for more on this) and follow all the applicable sections of the pull request template.
|
||||
- Please avoid modifying the changelog directly or updating the .pot files. These will be updated by the WooCommerce team.
|
||||
- Please create a change file for your changes by running `pnpm --filter=<project> changelog add`. For example, a change file for the WooCommerce Core project would be added by running `pnpm --filter=woocommerce changelog add`.
|
||||
- Please avoid modifying the changelog directly or updating the .pot files. These will be updated by the WooCommerce team.
|
||||
|
||||
If you are contributing code to the (Javascript-driven) Gutenberg blocks, note that it's developed in an external package.
|
||||
|
||||
- [Blocks](https://github.com/woocommerce/woocommerce-gutenberg-products-block)
|
||||
If you are contributing code to our (Javascript-driven) Gutenberg blocks, please note that they are developed in their [own repository](https://github.com/woocommerce/woocommerce-gutenberg-products-block) and have their [own issue tracker](https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues).
|
||||
|
||||
## Feature Requests 🚀
|
||||
|
||||
Feature requests can be [submitted to our issue tracker](https://github.com/woocommerce/woocommerce/issues/new?assignees=&labels=type%3A+enhancement%2Cstatus%3A+awaiting+triage&template=2-enhancement.yml&title=%5BEnhancement%5D%3A+). Be sure to include a description of the expected behavior and use case, and before submitting a request, please search for similar ones in the closed issues.
|
||||
The best place to submit feature requests is over on our [dedicated feature request page](https://woocommerce.com/feature-requests/woocommerce/). You can easily search and vote for existing requests, or create new requests if necessary.
|
||||
|
||||
Feature request issues will remain closed until we see sufficient interest via comments and [👍 reactions](https://help.github.com/articles/about-discussions-in-issues-and-pull-requests/) from the community.
|
||||
|
||||
You can see a [list of current feature requests which require votes here](https://github.com/woocommerce/woocommerce/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3A%22needs%3A+votes%22+).
|
||||
Alternatively, if you wish to propose a straightforward technical enhancement that is unlikely to require much discussion, you can [open a new issue](https://github.com/woocommerce/woocommerce/issues/new?assignees=&labels=type%3A+enhancement%2Cstatus%3A+awaiting+triage&template=2-enhancement.yml&title=%5BEnhancement%5D%3A+) right here on GitHub and, for any that may require more discussion, consider syncing with us during office hours or publishing a thread on [GitHub Discussions](https://github.com/woocommerce/woocommerce/discussions).
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: ✨ Enhancement Request
|
||||
description: If you have an idea to improve an existing feature in core or need something for development (such as a new hook) please let us know or submit a Pull Request!
|
||||
description: If you have an idea to improve existing functionality in core or need something for development (such as a new hook) please let us know or submit a Pull Request!
|
||||
title: "[Enhancement]: "
|
||||
labels: ["type: enhancement", "status: awaiting triage"]
|
||||
body:
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Feature Requests
|
||||
url: https://woocommerce.com/feature-requests/woocommerce/
|
||||
about: If you have an idea for a new feature that you wished existed in WooCommerce, take a look at our Feature Requests and vote, or open a new Feature Request yourself!
|
||||
- name: 🔒 Security issue
|
||||
url: https://hackerone.com/automattic/
|
||||
about: For security reasons, please report all security issues via HackerOne. If the issue is valid, a bug bounty will be paid out to you. Please disclose responsibly and not via GitHub (which allows for exploiting issues in the wild before the patch is released).
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
name: "\U0001F4C4 Request for New Document"
|
||||
about: Suggest the creation of a new documentation topic that doesn't exist yet.
|
||||
title: "[DOC-REQ]"
|
||||
labels: 'type: documentation'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Description of the Document Requested
|
||||
|
||||
> Provide a detailed description of the topic you'd like to see documented.
|
||||
|
||||
|
||||
|
||||
## Why is this Document Important?
|
||||
|
||||
> Explain why this topic is crucial and how it can benefit the WooCommerce community.
|
||||
|
||||
|
||||
|
||||
## Potential Content
|
||||
|
||||
> If you have an idea about what the new document should cover, list the points or sub-topics here.
|
||||
|
||||
|
||||
|
||||
## Additional Context
|
||||
|
||||
> Add any other context, references, or information that can help in the creation of this new document.
|
30
.github/ISSUE_TEMPLATE/suggestion-for-documentation-improvement-correction.md
vendored
Normal file
30
.github/ISSUE_TEMPLATE/suggestion-for-documentation-improvement-correction.md
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
name: "\U0001F4DD Suggestion for Documentation Improvement/Correction"
|
||||
about: Propose a specific improvement or correction for an existing document.
|
||||
title: "[DOC-BUG]"
|
||||
labels: 'type: documentation'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Link to the Page/Section
|
||||
|
||||
> Provide a link to the specific page or section that you're referring to.
|
||||
|
||||
|
||||
|
||||
## Description of the Suggestion
|
||||
|
||||
> Describe the changes you suggest to improve or correct the documentation. Be specific about any errors or areas of confusion you've identified.
|
||||
|
||||
|
||||
|
||||
## Reason for the Suggestion
|
||||
|
||||
> Why do you believe this change will make the documentation clearer or more accurate?
|
||||
|
||||
|
||||
|
||||
## Additional Context
|
||||
|
||||
> Add any other context, references, or screenshots that support your suggestion.
|
|
@ -1,15 +1,16 @@
|
|||
### All Submissions:
|
||||
### Submission Review Guidelines:
|
||||
|
||||
- [ ] Have you followed the [WooCommerce Contributing guideline](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md)?
|
||||
- [ ] Does your code follow the [WordPress' coding standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/)?
|
||||
- [ ] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/woocommerce/woocommerce/pulls) for the same update/change?
|
||||
|
||||
<!-- Mark completed items with an [x] -->
|
||||
- I have followed the [WooCommerce Contributing Guidelines](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md) and the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).
|
||||
- I have checked to ensure there aren't other open [Pull Requests](https://github.com/woocommerce/woocommerce/pulls) for the same update/change.
|
||||
- I have reviewed my code for [security best practices](https://developer.wordpress.org/apis/security/).
|
||||
- Following the above guidelines will result in quick merges and clear and detailed feedback when appropriate.
|
||||
|
||||
<!-- You can erase any parts of this template not applicable to your Pull Request. -->
|
||||
|
||||
### Changes proposed in this Pull Request:
|
||||
|
||||
<!-- If necessary, indicate if this PR is part of a bigger feature. Add a label with the format `focus: name of the feature [team:name of the team]`. -->
|
||||
|
||||
<!-- Describe the changes made to this Pull Request and the reason for such changes. -->
|
||||
|
||||
Closes # .
|
||||
|
@ -18,9 +19,9 @@ Closes # .
|
|||
|
||||
### How to test the changes in this Pull Request:
|
||||
|
||||
<!-- Please include detailed instructions on how these changes can be tested, make sure to review and follow the guide for writing high-quality testing instructions below. -->
|
||||
<!-- Include detailed instructions on how these changes can be tested. Review and follow the guide for how to write high-quality testing instructions. -->
|
||||
|
||||
- [ ] Have you followed the [Writing high-quality testing instructions guide](https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions)?
|
||||
Using the [WooCommerce Testing Instructions Guide](https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions), include your detailed testing instructions:
|
||||
|
||||
1.
|
||||
2.
|
||||
|
@ -28,15 +29,36 @@ Closes # .
|
|||
|
||||
<!-- End testing instructions -->
|
||||
|
||||
### Other information:
|
||||
### Changelog entry
|
||||
|
||||
- [ ] 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?
|
||||
- [ ] Have you created a changelog file for each project being changed, ie `pnpm --filter=<project> changelog add`?
|
||||
- [ ] Have you included testing instructions?
|
||||
<!-- You can optionally choose to enter a changelog entry by checking the box and supplying data. -->
|
||||
|
||||
<!-- Mark completed items with an [x] -->
|
||||
- [ ] Automatically create a changelog entry from the details below.
|
||||
|
||||
### FOR PR REVIEWER ONLY:
|
||||
<details>
|
||||
|
||||
- [ ] 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.
|
||||
#### Significance
|
||||
|
||||
<!-- Choose only one -->
|
||||
|
||||
- [ ] Patch
|
||||
- [ ] Minor
|
||||
- [ ] Major
|
||||
|
||||
#### Type
|
||||
|
||||
<!-- Choose only one -->
|
||||
|
||||
- [ ] Fix - Fixes an existing bug
|
||||
- [ ] Add - Adds functionality
|
||||
- [ ] Update - Update existing functionality
|
||||
- [ ] Dev - Development related task
|
||||
- [ ] Tweak - A minor adjustment to the codebase
|
||||
- [ ] Performance - Address performance issues
|
||||
- [ ] Enhancement - Improvement to existing functionality
|
||||
|
||||
#### Message <!-- Add a changelog message here -->
|
||||
|
||||
#### Comment <!-- If the changes in this pull request don't warrant a changelog entry, you can alternatively supply a comment here. Note that comments are only accepted with a significance of "Patch" -->
|
||||
|
||||
</details>
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
name: Send PRs that require further testing to Slack
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
TEST_ASSISTANCE_BOT_TOKEN:
|
||||
default: ''
|
||||
WOO_PR_TESTING_ANALYSIS_SLACK_CHANNEL:
|
||||
default: ''
|
||||
WOO_PR_TESTING_ANALYSIS_TEAM_ID:
|
||||
default: ''
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Get the PR status
|
||||
id: get_pr_status
|
||||
shell: bash
|
||||
run: |
|
||||
pr_status=${{ github.event.pull_request.merged == true && 'merged' || 'open' }}
|
||||
echo "pr_status=$pr_status" >> $GITHUB_OUTPUT
|
||||
- name: Calculate SLA timestamp
|
||||
id: calculate_sla
|
||||
shell: bash
|
||||
run: |
|
||||
sla_timestamp=$(date -d "+ 5 hours" -u +%s)
|
||||
echo "sla_timestamp=$sla_timestamp" >> $GITHUB_OUTPUT
|
||||
- name: Notify Slack Open
|
||||
uses: archive/github-actions-slack@d9dae40827adf93bddf939db6552d1e392259d7d
|
||||
id: notify-open
|
||||
if: steps.get_pr_status.outputs.pr_status == 'open'
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ inputs.TEST_ASSISTANCE_BOT_TOKEN }}
|
||||
slack-channel: ${{ inputs.WOO_PR_TESTING_ANALYSIS_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
<!subteam^${{ inputs.WOO_PR_TESTING_ANALYSIS_TEAM_ID }}>, there is a new *${{ steps.get_pr_status.outputs.pr_status }}* PR to analyze.
|
||||
<${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}> :thread:
|
||||
*SLA:* <!date^${{ steps.calculate_sla.outputs.sla_timestamp }}^{date_short_pretty} at {time}|5 hours from now>
|
||||
slack-optional-unfurl_links: false
|
||||
slack-optional-unfurl_media: false
|
||||
- name: Notify Slack Merged
|
||||
uses: archive/github-actions-slack@d9dae40827adf93bddf939db6552d1e392259d7d
|
||||
id: notify-merged
|
||||
if: steps.get_pr_status.outputs.pr_status == 'merged'
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ inputs.TEST_ASSISTANCE_BOT_TOKEN }}
|
||||
slack-channel: ${{ inputs.WOO_PR_TESTING_ANALYSIS_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
There is a new *${{ steps.get_pr_status.outputs.pr_status }}* PR to analyze.
|
||||
<${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}> :thread:
|
||||
slack-optional-unfurl_links: false
|
||||
slack-optional-unfurl_media: false
|
|
@ -29,7 +29,7 @@ runs:
|
|||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd
|
||||
with:
|
||||
version: '^7.22.0'
|
||||
version: '8.6.7'
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
||||
|
@ -43,10 +43,10 @@ runs:
|
|||
with:
|
||||
php-version: ${{ inputs.php-version }}
|
||||
coverage: none
|
||||
tools: phpcs, sirbrillig/phpcs-changed
|
||||
tools: phpcs, sirbrillig/phpcs-changed:2.11.1
|
||||
|
||||
- name: Cache Composer Dependencies
|
||||
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12
|
||||
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
|
||||
with:
|
||||
path: ~/.cache/composer/files
|
||||
key: ${{ runner.os }}-php-${{ inputs.php-version }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
|
@ -58,14 +58,27 @@ runs:
|
|||
pnpm -w install turbo
|
||||
pnpm install ${{ steps.parse-input.outputs.INSTALL_FILTERS }}
|
||||
|
||||
- name: Get branch name
|
||||
id: get_branch
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "pull_request" ]; then
|
||||
branch_name=$(echo "${{ github.head_ref }}" | tr '/' '-')
|
||||
echo "CURRENT_BRANCH_NAME=$branch_name" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "CURRENT_BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Cache Build Output
|
||||
uses: actions/cache@58c146cc91c5b9e778e71775dfe9bf1442ad9a12
|
||||
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
|
||||
with:
|
||||
path: node_modules/.cache/turbo
|
||||
key: ${{ runner.os }}-build-output-${{ hashFiles('node_modules/.cache/turbo/*-meta.json') }}
|
||||
restore-keys: ${{ runner.os }}-build-output-
|
||||
path: .turbo
|
||||
key: ${{ runner.os }}-build-output-${{ steps.get_branch.outputs.CURRENT_BRANCH_NAME }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-output-${{ steps.get_branch.outputs.CURRENT_BRANCH_NAME }}
|
||||
${{ runner.os }}-build-output
|
||||
|
||||
- name: Build
|
||||
if: ${{ inputs.build == 'true' }}
|
||||
shell: bash
|
||||
run: pnpm -w exec turbo run turbo:build ${{ steps.parse-input.outputs.BUILD_FILTERS }}
|
||||
run: pnpm -w exec turbo run turbo:build --cache-dir=".turbo" ${{ steps.parse-input.outputs.BUILD_FILTERS }}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
name: Run API tests
|
||||
description: Runs the WooCommerce Core API tests and generates Allure report.
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
report-name:
|
||||
description: Name of Allure report to be generated.
|
||||
required: true
|
||||
tests:
|
||||
description: Specific tests to run, separated by single whitespace. See https://playwright.dev/docs/test-cli
|
||||
|
||||
outputs:
|
||||
result:
|
||||
description: Whether the test passed or failed.
|
||||
value: ${{ steps.run-api-tests.conclusion }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Run API tests.
|
||||
id: run-api-tests
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm exec playwright test \
|
||||
--config=tests/api-core-tests/playwright.config.js \
|
||||
${{ inputs.tests }}
|
||||
|
||||
- name: Generate Test report.
|
||||
if: success() || ( failure() && steps.run-api-tests.conclusion == 'failure' )
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive test report
|
||||
if: success() || ( failure() && steps.run-api-tests.conclusion == 'failure' )
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ inputs.report-name }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
retention-days: 20
|
|
@ -0,0 +1,54 @@
|
|||
name: Run E2E tests
|
||||
description: Runs the WooCommerce Core E2E tests and generates Allure report.
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
report-name:
|
||||
description: Name of Allure report to be generated.
|
||||
required: true
|
||||
tests:
|
||||
description: Specific tests to run, separated by single whitespace. See https://playwright.dev/docs/test-cli
|
||||
playwright-config:
|
||||
description: The Playwright configuration file to use.
|
||||
default: playwright.config.js
|
||||
|
||||
outputs:
|
||||
result:
|
||||
description: Whether the test passed or failed.
|
||||
value: ${{ steps.run-e2e-tests.conclusion }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Download and install Chromium browser.
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Run E2E tests.
|
||||
id: run-e2e-tests
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
USE_WP_ENV: 1
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm exec playwright test \
|
||||
--config=tests/e2e-pw/${{ inputs.playwright-config }} \
|
||||
${{ inputs.tests }}
|
||||
|
||||
- name: Generate Test report.
|
||||
if: success() || ( failure() && steps.run-e2e-tests.conclusion == 'failure' )
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive test report
|
||||
if: success() || ( failure() && steps.run-e2e-tests.conclusion == 'failure' )
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ inputs.report-name }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
retention-days: 20
|
|
@ -0,0 +1,17 @@
|
|||
name: Run k6 performance tests
|
||||
description: Runs the WooCommerce Core k6 performance tests.
|
||||
permissions: {}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Install k6
|
||||
shell: bash
|
||||
run: |
|
||||
curl https://github.com/grafana/k6/releases/download/v0.33.0/k6-v0.33.0-linux-amd64.tar.gz -L | tar xvz --strip-components 1
|
||||
|
||||
- name: Run k6 performance tests
|
||||
id: run-k6-tests
|
||||
shell: bash
|
||||
run: |
|
||||
./k6 run plugins/woocommerce/tests/performance/tests/gh-action-pr-requests.js
|
|
@ -0,0 +1,29 @@
|
|||
name: Setup local test environment
|
||||
description: Set up a wp-env testing environment
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
test-type:
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- e2e
|
||||
- api
|
||||
- k6
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Load docker images and start containers for E2E or API tests
|
||||
if: ( inputs.test-type == 'e2e' ) || ( inputs.test-type == 'api' )
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: pnpm run env:test
|
||||
|
||||
- name: Load docker images and start containers for k6 performance tests
|
||||
if: inputs.test-type == 'k6'
|
||||
working-directory: plugins/woocommerce
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm env:dev --filter=woocommerce
|
||||
pnpm env:performance-init --filter=woocommerce
|
|
@ -0,0 +1,41 @@
|
|||
name: Send Slack alert on PR merge test failure
|
||||
description: Send a Slack alert when automated tests failed on trunk after PR merge.
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
slack-bot-token:
|
||||
required: true
|
||||
channel-id:
|
||||
required: true
|
||||
test-type:
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- E2E
|
||||
- API
|
||||
- k6
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Compose Slack message
|
||||
id: compose-slack-message
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
SHA: ${{ github.event.pull_request.merge_commit_sha }}
|
||||
TEST_TYPE: ${{ inputs.test-type }}
|
||||
with:
|
||||
script: |
|
||||
const script = require('./.github/actions/tests/slack-alert-on-pr-merge/scripts/compose-slack-message.js')
|
||||
const slackMessage = script()
|
||||
core.setOutput('slack-message', slackMessage)
|
||||
|
||||
- name: Send Slack alert
|
||||
uses: slackapi/slack-github-action@v1.23.0
|
||||
env:
|
||||
SLACK_BOT_TOKEN: ${{ inputs.slack-bot-token }}
|
||||
with:
|
||||
channel-id: ${{ inputs.channel-id }}
|
||||
payload: ${{ steps.compose-slack-message.outputs.slack-message }}
|
114
.github/actions/tests/slack-alert-on-pr-merge/scripts/compose-slack-message.js
vendored
Normal file
114
.github/actions/tests/slack-alert-on-pr-merge/scripts/compose-slack-message.js
vendored
Normal file
|
@ -0,0 +1,114 @@
|
|||
module.exports = () => {
|
||||
const {
|
||||
GITHUB_BASE_REF,
|
||||
GITHUB_RUN_ID,
|
||||
PR_NUMBER,
|
||||
PR_TITLE,
|
||||
SHA,
|
||||
TEST_TYPE,
|
||||
} = process.env;
|
||||
|
||||
// Slack message blocks
|
||||
const blocks = [];
|
||||
const dividerBlock = {
|
||||
type: 'divider',
|
||||
};
|
||||
const introBlock = {
|
||||
type: 'section',
|
||||
text: {
|
||||
type: 'mrkdwn',
|
||||
text: `${ TEST_TYPE } tests failed on \`${ GITHUB_BASE_REF }\` after merging PR <https://github.com/woocommerce/woocommerce/pull/${ PR_NUMBER }|#${ PR_NUMBER }>`,
|
||||
},
|
||||
};
|
||||
const prTitleBlock = {
|
||||
type: 'header',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: PR_TITLE,
|
||||
emoji: true,
|
||||
},
|
||||
};
|
||||
const prButtonBlock = {
|
||||
type: 'actions',
|
||||
elements: [
|
||||
{
|
||||
type: 'button',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: 'View pull request :pr-merged:',
|
||||
emoji: true,
|
||||
},
|
||||
value: 'view_pr',
|
||||
url: `https://github.com/woocommerce/woocommerce/pull/${ PR_NUMBER }`,
|
||||
action_id: 'view-pr',
|
||||
},
|
||||
],
|
||||
};
|
||||
const mergeCommitBlock = {
|
||||
type: 'actions',
|
||||
elements: [
|
||||
{
|
||||
type: 'button',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: `View merge commit ${ SHA.substring(
|
||||
0,
|
||||
7
|
||||
) } :alphabet-yellow-hash:`,
|
||||
emoji: true,
|
||||
},
|
||||
value: 'view_commit',
|
||||
url: `https://github.com/woocommerce/woocommerce/commit/${ SHA }`,
|
||||
action_id: 'view-commit',
|
||||
},
|
||||
],
|
||||
};
|
||||
const githubBlock = {
|
||||
type: 'actions',
|
||||
elements: [
|
||||
{
|
||||
type: 'button',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: 'View GitHub run log :github:',
|
||||
emoji: true,
|
||||
},
|
||||
value: 'view_github',
|
||||
url: `https://github.com/woocommerce/woocommerce/actions/runs/${ GITHUB_RUN_ID }`,
|
||||
action_id: 'view-github',
|
||||
},
|
||||
],
|
||||
};
|
||||
const reportBlock = {
|
||||
type: 'actions',
|
||||
elements: [
|
||||
{
|
||||
type: 'button',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: 'View test report :colorful-bar-chart:',
|
||||
emoji: true,
|
||||
},
|
||||
value: 'view_report',
|
||||
url: `https://woocommerce.github.io/woocommerce-test-reports/pr-merge/${ PR_NUMBER }/${ TEST_TYPE.toLowerCase() }`,
|
||||
action_id: 'view-report',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// Assemble blocks
|
||||
blocks.push( dividerBlock );
|
||||
blocks.push( introBlock );
|
||||
blocks.push( prTitleBlock );
|
||||
blocks.push( prButtonBlock );
|
||||
blocks.push( mergeCommitBlock );
|
||||
blocks.push( githubBlock );
|
||||
|
||||
if ( [ 'e2e', 'api' ].includes( TEST_TYPE.toLowerCase() ) ) {
|
||||
blocks.push( reportBlock );
|
||||
}
|
||||
|
||||
blocks.push( dividerBlock );
|
||||
|
||||
return { blocks };
|
||||
};
|
|
@ -0,0 +1,59 @@
|
|||
name: Compose a Slack block for release tests
|
||||
description: Create a Slack block that shows the API and E2E test results from one of the release tests, and upload it as an artifact.
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
test-name:
|
||||
required: true
|
||||
api-result:
|
||||
required: true
|
||||
type: choice
|
||||
default: skipped
|
||||
options:
|
||||
- success
|
||||
- failure
|
||||
- cancelled
|
||||
- skipped
|
||||
e2e-result:
|
||||
required: true
|
||||
type: choice
|
||||
default: skipped
|
||||
options:
|
||||
- success
|
||||
- failure
|
||||
- cancelled
|
||||
- skipped
|
||||
env-slug:
|
||||
required: true
|
||||
release-version:
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Create context block as a JSON object
|
||||
id: generate-json
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const script = require('./.github/actions/tests/slack-summary-on-release/slack-blocks/scripts/create-result-block');
|
||||
return script();
|
||||
env:
|
||||
API_RESULT: ${{ inputs.api-result }}
|
||||
E2E_RESULT: ${{ inputs.e2e-result }}
|
||||
ENV_SLUG: ${{ inputs.env-slug }}
|
||||
TEST_NAME: ${{ inputs.test-name }}
|
||||
RELEASE_VERSION: ${{ inputs.release-version }}
|
||||
|
||||
- name: Write JSON file
|
||||
working-directory: /tmp
|
||||
shell: bash
|
||||
env:
|
||||
CONTEXT_JSON: ${{ toJSON(steps.generate-json.outputs.result) }}
|
||||
run: echo ${{ env.CONTEXT_JSON }} > "${{ inputs.test-name }}.json"
|
||||
|
||||
- name: Upload JSON file as artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.SLACK_BLOCKS_ARTIFACT }}
|
||||
path: /tmp/${{ inputs.test-name }}.json
|
31
.github/actions/tests/slack-summary-on-release/slack-blocks/scripts/create-result-block/index.js
vendored
Normal file
31
.github/actions/tests/slack-summary-on-release/slack-blocks/scripts/create-result-block/index.js
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
module.exports = () => {
|
||||
const { API_RESULT, E2E_RESULT, ENV_SLUG, TEST_NAME, RELEASE_VERSION } =
|
||||
process.env;
|
||||
const { setElementText } = require( './utils' );
|
||||
|
||||
const apiLinkText = setElementText( {
|
||||
testType: 'API',
|
||||
result: API_RESULT,
|
||||
envSlug: ENV_SLUG,
|
||||
releaseVersion: RELEASE_VERSION,
|
||||
} );
|
||||
const e2eLinkText = setElementText( {
|
||||
testType: 'E2E',
|
||||
result: E2E_RESULT,
|
||||
envSlug: ENV_SLUG,
|
||||
releaseVersion: RELEASE_VERSION,
|
||||
} );
|
||||
const elementText = `*${ TEST_NAME }*\n ${ apiLinkText } ${ e2eLinkText }`;
|
||||
|
||||
const contextBlock = {
|
||||
type: 'context',
|
||||
elements: [
|
||||
{
|
||||
type: 'mrkdwn',
|
||||
text: elementText,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return contextBlock;
|
||||
};
|
|
@ -0,0 +1,5 @@
|
|||
const { setElementText } = require( './set-element-text' );
|
||||
|
||||
module.exports = {
|
||||
setElementText,
|
||||
};
|
|
@ -0,0 +1,26 @@
|
|||
const emojis = {
|
||||
PASSED: ':workflow-passed:',
|
||||
FAILED: ':workflow-failed:',
|
||||
SKIPPED: ':workflow-skipped:',
|
||||
CANCELLED: ':workflow-cancelled:',
|
||||
UNKNOWN: ':grey_question:',
|
||||
};
|
||||
|
||||
const selectEmoji = ( result ) => {
|
||||
switch ( result ) {
|
||||
case 'success':
|
||||
return emojis.PASSED;
|
||||
case 'failure':
|
||||
return emojis.FAILED;
|
||||
case 'skipped':
|
||||
return emojis.SKIPPED;
|
||||
case 'cancelled':
|
||||
return emojis.CANCELLED;
|
||||
default:
|
||||
return emojis.UNKNOWN;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
selectEmoji,
|
||||
};
|
|
@ -0,0 +1,12 @@
|
|||
const setElementText = ( { testType, result, envSlug, releaseVersion } ) => {
|
||||
const { selectEmoji } = require( './select-emoji' );
|
||||
const allureReportURL = `https://woocommerce.github.io/woocommerce-test-reports/release/${ releaseVersion }/${ envSlug }/${ testType.toLowerCase() }`;
|
||||
const emoji = selectEmoji( result );
|
||||
const textValue = `<${ allureReportURL }|${ testType.toUpperCase() } ${ emoji }>`;
|
||||
|
||||
return textValue;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
setElementText,
|
||||
};
|
|
@ -0,0 +1,27 @@
|
|||
name: Combine all Slack blocks
|
||||
description: Combine all Slack blocks to construct the payload for the Slack GitHub action
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
release-version:
|
||||
required: true
|
||||
blocks-dir:
|
||||
require: true
|
||||
|
||||
outputs:
|
||||
payload:
|
||||
value: ${{ steps.payload.outputs.result }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Construct payload from all blocks
|
||||
id: payload
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
RELEASE_VERSION: ${{ inputs.release-version }}
|
||||
BLOCKS_DIR: ${{ inputs.blocks-dir }}
|
||||
with:
|
||||
script: |
|
||||
const script = require('./.github/actions/tests/slack-summary-on-release/slack-payload/scripts/construct-payload');
|
||||
return script();
|
36
.github/actions/tests/slack-summary-on-release/slack-payload/scripts/construct-payload/index.js
vendored
Normal file
36
.github/actions/tests/slack-summary-on-release/slack-payload/scripts/construct-payload/index.js
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
module.exports = () => {
|
||||
const { RELEASE_VERSION, BLOCKS_DIR } = process.env;
|
||||
const {
|
||||
filterContextBlocks,
|
||||
readContextBlocksFromJsonFiles,
|
||||
} = require( './utils' );
|
||||
|
||||
const headerText = `Test summary for ${ RELEASE_VERSION }`;
|
||||
const headerBlock = {
|
||||
type: 'header',
|
||||
text: {
|
||||
type: 'plain_text',
|
||||
text: headerText,
|
||||
emoji: true,
|
||||
},
|
||||
};
|
||||
|
||||
const blocks_all = readContextBlocksFromJsonFiles( BLOCKS_DIR );
|
||||
const blocks_wcUpdate = filterContextBlocks( blocks_all, 'WC Update' );
|
||||
const blocks_wpVersions = filterContextBlocks( blocks_all, 'WP Latest' );
|
||||
const blocks_phpVersions = filterContextBlocks( blocks_all, 'PHP' );
|
||||
const blocks_plugins = filterContextBlocks( blocks_all, 'With' );
|
||||
|
||||
const blocksPayload = [ headerBlock ]
|
||||
.concat( blocks_wcUpdate )
|
||||
.concat( blocks_wpVersions )
|
||||
.concat( blocks_phpVersions )
|
||||
.concat( blocks_plugins );
|
||||
|
||||
const payload = {
|
||||
text: headerText,
|
||||
blocks: blocksPayload,
|
||||
};
|
||||
|
||||
return payload;
|
||||
};
|
|
@ -0,0 +1,42 @@
|
|||
const fs = require( 'fs' );
|
||||
const path = require( 'path' );
|
||||
|
||||
const readContextBlocksFromJsonFiles = ( blocksDir ) => {
|
||||
const jsonsDir = path.resolve( blocksDir );
|
||||
const jsons = fs.readdirSync( jsonsDir );
|
||||
|
||||
let contextBlocks = [];
|
||||
|
||||
for ( const json of jsons ) {
|
||||
const jsonPath = path.resolve( jsonsDir, json );
|
||||
const contextBlock = require( jsonPath );
|
||||
|
||||
contextBlocks.push( contextBlock );
|
||||
}
|
||||
|
||||
return contextBlocks;
|
||||
};
|
||||
|
||||
const filterContextBlocks = ( blocks, testName ) => {
|
||||
const divider = {
|
||||
type: 'divider',
|
||||
};
|
||||
|
||||
let filteredBlocks = [];
|
||||
|
||||
const matchingBlocks = blocks.filter( ( { elements } ) =>
|
||||
elements[ 0 ].text.includes( testName )
|
||||
);
|
||||
|
||||
matchingBlocks.forEach( ( block ) => {
|
||||
filteredBlocks.push( block );
|
||||
filteredBlocks.push( divider );
|
||||
} );
|
||||
|
||||
return filteredBlocks;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
filterContextBlocks,
|
||||
readContextBlocksFromJsonFiles,
|
||||
};
|
|
@ -0,0 +1,6 @@
|
|||
const {
|
||||
filterContextBlocks,
|
||||
readContextBlocksFromJsonFiles,
|
||||
} = require( './get-context-blocks' );
|
||||
|
||||
module.exports = { filterContextBlocks, readContextBlocksFromJsonFiles };
|
|
@ -0,0 +1,37 @@
|
|||
name: Upload Allure files to bucket
|
||||
description: Upload Allure files to bucket.
|
||||
permissions: {}
|
||||
|
||||
inputs:
|
||||
artifact-name:
|
||||
description: Name of the artifact that contains the allure-report and/or allure-results folders.
|
||||
required: true
|
||||
aws-region:
|
||||
required: true
|
||||
aws-access-key-id:
|
||||
required: true
|
||||
aws-secret-access-key:
|
||||
required: true
|
||||
s3-bucket:
|
||||
required: true
|
||||
include-allure-results:
|
||||
dafault: false
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1-node16
|
||||
with:
|
||||
aws-region: ${{ inputs.aws-region }}
|
||||
aws-access-key-id: ${{ inputs.aws-access-key-id }}
|
||||
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
|
||||
|
||||
- name: Upload Allure artifact
|
||||
env:
|
||||
ARTIFACT_NAME: ${{ inputs.artifact-name }}
|
||||
S3_BUCKET: ${{ inputs.s3-bucket }}
|
||||
INCLUDE_ALLURE_RESULTS: ${{ inputs.include-allure-results }}
|
||||
shell: bash
|
||||
working-directory: .github/actions/tests/upload-allure-files-to-bucket/scripts
|
||||
run: bash upload-allure-artifact.sh
|
30
.github/actions/tests/upload-allure-files-to-bucket/scripts/upload-allure-artifact.sh
vendored
Normal file
30
.github/actions/tests/upload-allure-files-to-bucket/scripts/upload-allure-artifact.sh
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
s3_upload () {
|
||||
aws s3 cp "$1" "$2" \
|
||||
--recursive
|
||||
}
|
||||
|
||||
upload_allure_results () {
|
||||
if [[ $INCLUDE_ALLURE_RESULTS != "true" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
SOURCE="$ALLURE_RESULTS_DIR"
|
||||
DESTINATION="$S3_BUCKET/artifacts/$GITHUB_RUN_ID/$ARTIFACT_NAME/allure-results"
|
||||
|
||||
s3_upload "$SOURCE" "$DESTINATION"
|
||||
}
|
||||
|
||||
upload_allure_report () {
|
||||
SOURCE="$ALLURE_REPORT_DIR"
|
||||
DESTINATION="$S3_BUCKET/artifacts/$GITHUB_RUN_ID/$ARTIFACT_NAME/allure-report"
|
||||
|
||||
s3_upload "$SOURCE" "$DESTINATION"
|
||||
}
|
||||
|
||||
upload_allure_results
|
||||
upload_allure_report
|
||||
|
||||
EXIT_CODE=$(echo $?)
|
||||
exit $EXIT_CODE
|
|
@ -61,7 +61,17 @@
|
|||
'plugin: woocommerce':
|
||||
- plugins/woocommerce/**/*
|
||||
|
||||
'focus: react admin [team:Ghidorah]':
|
||||
- plugins/woocommerce/src/Admin/**/*
|
||||
- plugins/woocommerce/src/Internal/Admin/**/*
|
||||
- plugins/woocommerce-admin/**/*
|
||||
'plugin: woocommerce beta tester':
|
||||
- plugins/woocommerce-beta-tester/**/*
|
||||
|
||||
'plugin: woo-ai':
|
||||
- plugins/woo-ai/**/*
|
||||
|
||||
'focus: performance tests [team:Solaris]':
|
||||
- plugins/woocommerce/tests/performance/**/*
|
||||
|
||||
'focus: api tests [team:Solaris]':
|
||||
- plugins/woocommerce/tests/api-core-tests/**/*
|
||||
|
||||
'focus: e2e tests [team:Solaris]':
|
||||
- plugins/woocommerce/tests/e2e-pw/**/*
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
name: Build live branch when trunk updated
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- trunk
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository_owner == 'woocommerce' && github.actor != 'github-actions[bot]'
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Get current version
|
||||
id: version
|
||||
uses: actions/github-script@v6.3.3
|
||||
with:
|
||||
script:
|
||||
const { getVersion } = require( './.github/workflows/scripts/get-plugin-version' );
|
||||
const version = await getVersion( 'woocommerce' );
|
||||
core.setOutput( 'version', version );
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
build: false
|
||||
|
||||
- name: Prepare plugin zips
|
||||
id: prepare
|
||||
env:
|
||||
CURRENT_VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
|
||||
# Current version must compare greather than any previously used current version for this PR.
|
||||
# Assume GH run IDs are monotonic.
|
||||
VERSUFFIX="${GITHUB_RUN_ID}-g$(git rev-parse --short HEAD)"
|
||||
|
||||
CURRENT_VERSION="$CURRENT_VERSION-$VERSUFFIX"
|
||||
|
||||
sed -i -e 's/Version: .*$/Version: '"$CURRENT_VERSION"'/' "$GITHUB_WORKSPACE/plugins/woocommerce/woocommerce.php"
|
||||
echo "$CURRENT_VERSION" > "$GITHUB_WORKSPACE/plugins/woocommerce/version.txt"
|
||||
|
||||
cd "$GITHUB_WORKSPACE/plugins/woocommerce"
|
||||
bash bin/build-zip.sh
|
||||
|
||||
mkdir "$GITHUB_WORKSPACE/zips"
|
||||
cp "$GITHUB_WORKSPACE/plugins/woocommerce/woocommerce.zip" "$GITHUB_WORKSPACE/zips/woocommerce.zip"
|
||||
cd "$GITHUB_WORKSPACE/zips"
|
||||
unzip woocommerce.zip
|
||||
rm woocommerce.zip
|
||||
mv woocommerce woocommerce-dev
|
||||
zip -q -r "woocommerce-dev.zip" "woocommerce-dev/"
|
||||
rm -fR "$GITHUB_WORKSPACE/zips/woocommerce-dev"
|
||||
|
||||
# Plugin data is passed as a JSON object.
|
||||
PLUGIN_DATA="{}"
|
||||
PLUGIN_DATA=$( jq -c --arg slug "woocommerce" --arg ver "$CURRENT_VERSION" '.[ $slug ] = { version: $ver }' <<<"$PLUGIN_DATA" )
|
||||
echo "plugin-data=$PLUGIN_DATA" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create plugins artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
if: steps.prepare.outputs.plugin-data != '{}'
|
||||
with:
|
||||
name: plugins
|
||||
path: zips
|
||||
# Only need to retain for a day since the beta builder slurps it up to distribute.
|
||||
retention-days: 1
|
||||
|
||||
- name: Inform Beta Download webhook
|
||||
if: steps.prepare.outputs.plugin-data != '{}'
|
||||
env:
|
||||
SECRET: ${{ secrets.WOOBETA_SECRET }}
|
||||
PLUGIN_DATA: ${{ steps.prepare.outputs.plugin-data }}
|
||||
run: |
|
||||
curl -v --fail -L \
|
||||
--url "https://betadownload.jetpack.me/gh-action.php?run_id=$GITHUB_RUN_ID&commit=$GITHUB_SHA" \
|
||||
--form-string "repo=$GITHUB_REPOSITORY" \
|
||||
--form-string "branch=${GITHUB_REF#refs/heads/}" \
|
||||
--form-string "plugins=$PLUGIN_DATA" \
|
||||
--form-string "secret=$SECRET"
|
|
@ -1,50 +0,0 @@
|
|||
name: Build release asset
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build release asset
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
build: false
|
||||
|
||||
- name: Build zip
|
||||
working-directory: plugins/woocommerce
|
||||
run: bash bin/build-zip.sh
|
||||
|
||||
- name: Upload release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: plugins/woocommerce/woocommerce.zip
|
||||
asset_name: woocommerce.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
|
||||
update-code-reference:
|
||||
if: github.event.release.prerelease == false && github.event.release.draft == false && github.repository_owner == 'woocommerce'
|
||||
name: Update Code Reference
|
||||
needs: build
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Invoke Code Reference build and deploy workflow
|
||||
uses: aurelien-baudet/workflow-dispatch@v2
|
||||
with:
|
||||
workflow: GitHub Pages deploy
|
||||
repo: woocommerce/code-reference
|
||||
token: ${{ secrets.CUSTOM_GH_TOKEN }}
|
||||
ref: refs/heads/trunk
|
||||
inputs: '{ "version": "${{ github.event.release.tag_name }}" }'
|
|
@ -1,287 +0,0 @@
|
|||
name: Bump WP L-2 Support
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
releaseBranch:
|
||||
description: Provide the release branch you want to bump the WP L-2 support. Example release/6.9. Note that trunk will also be bumped to match.
|
||||
default: ''
|
||||
required: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
env:
|
||||
GIT_COMMITTER_NAME: 'WooCommerce Bot'
|
||||
GIT_COMMITTER_EMAIL: 'no-reply@woocommerce.com'
|
||||
GIT_AUTHOR_NAME: 'WooCommerce Bot'
|
||||
GIT_AUTHOR_EMAIL: 'no-reply@woocommerce.com'
|
||||
|
||||
jobs:
|
||||
check-release-branch-exists:
|
||||
name: Check for existence of release branch
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Check for release branch
|
||||
id: release-branch-check
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
// This will throw an error for non-200 responses, which prevents subsequent jobs from completing, as desired.
|
||||
await github.request( 'GET /repos/{owner}/{repo}/branches/{branch}', {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
branch: '${{ inputs.releaseBranch }}',
|
||||
} );
|
||||
|
||||
validate-bump:
|
||||
name: Validate and bump WP L-2 support version
|
||||
runs-on: ubuntu-20.04
|
||||
needs: check-release-branch-exists
|
||||
if: success()
|
||||
permissions:
|
||||
actions: write
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Get latest WP version
|
||||
id: latestWP
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const https = require( 'https' );
|
||||
|
||||
https.get( 'https://api.wordpress.org/core/stable-check/1.0/', ( resp ) => {
|
||||
let data = '';
|
||||
|
||||
// A chunk of data has been received.
|
||||
resp.on( 'data', ( chunk ) => {
|
||||
data += chunk;
|
||||
} );
|
||||
|
||||
// The whole response has been received. Print out the result.
|
||||
resp.on( 'end', () => {
|
||||
JSON.parse(data, ( key, val ) => {
|
||||
if ( val === 'latest' ) {
|
||||
core.setOutput( 'version', key )
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
} ).on( 'error', ( err ) => {
|
||||
console.log( 'Error: ' + err.message );
|
||||
} );
|
||||
|
||||
- name: Get L-2 WP version
|
||||
id: l2Version
|
||||
if: steps.latestWP.outputs.version != '' && steps.latestWP.outputs.version != null
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const version = "${{ steps.latestWP.outputs.version }}";
|
||||
const latestWPVersionMajor = version.split( '.' )[0];
|
||||
const latestWPVersionMinor = version.split( '.' )[1];
|
||||
const l2 = (parseInt( ( latestWPVersionMajor + latestWPVersionMinor ), 10 ) - 2 ).toString();
|
||||
const l2Major = l2.split( '' )[0];
|
||||
const l2Minor = l2.split( '' )[1];
|
||||
core.setOutput( 'version', l2Major + '.' + l2Minor );
|
||||
|
||||
- name: Git fetch the release branch
|
||||
run: git fetch origin ${{ inputs.releaseBranch }}
|
||||
|
||||
- name: Checkout release branch
|
||||
run: git checkout ${{ inputs.releaseBranch }}
|
||||
|
||||
- name: Create a PR branch based on release branch
|
||||
run: git checkout -b WP-L-2-version-support-${{ steps.l2Version.outputs.version }}/${{ inputs.releaseBranch }}
|
||||
|
||||
- name: Check if WP L-2 support needs to be bumped the release branch
|
||||
id: readmeWPVersion
|
||||
if: steps.l2Version.outputs.version != '' && steps.l2Version.outputs.version != null
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const fs = require( 'node:fs' );
|
||||
const l2Version = "${{ steps.l2Version.outputs.version }}";
|
||||
let readme = '';
|
||||
|
||||
fs.readFile( './plugins/woocommerce/readme.txt', 'utf-8', function( err, data ) {
|
||||
if ( err ) {
|
||||
console.error( err );
|
||||
}
|
||||
|
||||
readme = data.split( "\n" );
|
||||
const newReadme = [];
|
||||
let needsChange = false;
|
||||
|
||||
for ( const line of readme ) {
|
||||
if ( line.match( /Requires\sat\sleast:\s\d+\.\d/ ) ) {
|
||||
const readmeVersion = line.match( /\d+\.\d/ );
|
||||
|
||||
// If the versions don't match, means we need to make a change.
|
||||
if ( readmeVersion != l2Version ) {
|
||||
needsChange = true;
|
||||
|
||||
newReadme.push( 'Requires at least: ' + l2Version );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
newReadme.push( line );
|
||||
}
|
||||
|
||||
if ( needsChange ) {
|
||||
fs.writeFile( './plugins/woocommerce/readme.txt', newReadme.join( "\n" ), err => {
|
||||
if ( err ) {
|
||||
core.setFailed( `Unable to bump the WP L-2 support version. ${err}` );
|
||||
}
|
||||
|
||||
core.setOutput( 'needsChange', needsChange );
|
||||
|
||||
// Copy the readme.txt file to the root of VM to be used later.
|
||||
fs.writeFile( '../../readme.txt', newReadme.join( "\n" ), err => {
|
||||
if ( err ) {
|
||||
core.setFailed( `Unable to copy the readme.txt file to the root of VM. ${err}` );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} else {
|
||||
core.setFailed( 'No changes needed. WP Version is L-2 compatible.' );
|
||||
}
|
||||
} );
|
||||
|
||||
- name: Commit changes
|
||||
if: steps.readmeWPVersion.outputs.needsChange == 'true'
|
||||
run: git commit --no-verify -am "Update readme.txt WP L-2 support version."
|
||||
|
||||
- name: Push changes
|
||||
if: steps.readmeWPVersion.outputs.needsChange == 'true'
|
||||
run: git push origin WP-L-2-version-support-${{ steps.l2Version.outputs.version }}/${{ inputs.releaseBranch }}
|
||||
|
||||
- name: Push the PR up to GitHub
|
||||
id: release-branch-pr
|
||||
if: steps.readmeWPVersion.outputs.needsChange == 'true'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const PRBody = "This PR bumps the WP version to L-2 compatible for the release branch ${{ inputs.releaseBranch }}.\n";
|
||||
|
||||
const pr = await github.rest.pulls.create( {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: "Bump WP Version to L-2 compatible for ${{ inputs.releaseBranch }}",
|
||||
head: "WP-L-2-version-support-${{ steps.l2Version.outputs.version }}/${{ inputs.releaseBranch }}",
|
||||
base: "${{ inputs.releaseBranch }}",
|
||||
body: PRBody
|
||||
} );
|
||||
|
||||
if ( pr.status != 201 ) {
|
||||
core.setFailed( "Unable to push WP-L-2-version-support-${{ steps.l2Version.outputs.version }}/${{ inputs.releaseBranch }} to GitHub." );
|
||||
}
|
||||
|
||||
core.setOutput( 'pr', pr.data.number );
|
||||
|
||||
await github.rest.pulls.requestReviewers( {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: pr.data.number,
|
||||
reviewers: [ context.actor ]
|
||||
} );
|
||||
|
||||
- name: Checkout trunk branch
|
||||
if: steps.release-branch-pr.outputs.pr != '' && steps.release-branch-pr.outputs.pr != null
|
||||
run: git checkout trunk
|
||||
|
||||
- name: Create a branch based on trunk branch
|
||||
if: steps.release-branch-pr.outputs.pr != '' && steps.release-branch-pr.outputs.pr != null
|
||||
run: git checkout -b WP-L-2-version-support-${{ steps.l2Version.outputs.version }}/trunk
|
||||
|
||||
- name: Check if WP L-2 support needs to be bumped for trunk
|
||||
id: readmeWPVersionTrunk
|
||||
if: steps.release-branch-pr.outputs.pr != '' && steps.release-branch-pr.outputs.pr != null
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const fs = require( 'node:fs' );
|
||||
const l2Version = "${{ steps.l2Version.outputs.version }}";
|
||||
let readme = '';
|
||||
|
||||
fs.readFile( './plugins/woocommerce/readme.txt', 'utf-8', function( err, data ) {
|
||||
if ( err ) {
|
||||
console.error( err );
|
||||
}
|
||||
|
||||
readme = data.split( "\n" );
|
||||
const newReadme = [];
|
||||
let needsChange = false;
|
||||
|
||||
for ( const line of readme ) {
|
||||
if ( line.match( /Requires\sat\sleast:\s\d+\.\d/ ) ) {
|
||||
const readmeVersion = line.match( /\d+\.\d/ );
|
||||
|
||||
// If the versions don't match, means we need to make a change.
|
||||
if ( readmeVersion != l2Version ) {
|
||||
needsChange = true;
|
||||
|
||||
newReadme.push( 'Requires at least: ' + l2Version );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
newReadme.push( line );
|
||||
}
|
||||
|
||||
if ( needsChange ) {
|
||||
fs.writeFile( './plugins/woocommerce/readme.txt', newReadme.join( "\n" ), err => {
|
||||
if ( err ) {
|
||||
core.setFailed( `Unable to bump the WP L-2 support version. ${err}` );
|
||||
}
|
||||
|
||||
core.setOutput( 'needsChange', needsChange );
|
||||
|
||||
// Copy the readme.txt file to the root of VM to be used later.
|
||||
fs.writeFile( '../../readme.txt', newReadme.join( "\n" ), err => {
|
||||
if ( err ) {
|
||||
core.setFailed( `Unable to copy the readme.txt file to the root of VM. ${err}` );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} else {
|
||||
core.setFailed( 'No changes needed. WP Version is L-2 compatible.' );
|
||||
}
|
||||
} );
|
||||
|
||||
- name: Commit changes
|
||||
if: steps.readmeWPVersionTrunk.outputs.needsChange == 'true'
|
||||
run: git commit --no-verify -am "Update readme.txt WP L-2 support version."
|
||||
|
||||
- name: Push changes
|
||||
if: steps.readmeWPVersionTrunk.outputs.needsChange == 'true'
|
||||
run: git push origin WP-L-2-version-support-${{ steps.l2Version.outputs.version }}/trunk
|
||||
|
||||
- name: Push the PR up to GitHub
|
||||
if: steps.readmeWPVersionTrunk.outputs.needsChange == 'true'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const PRBody = "This PR bumps the WP version to L-2 compatible for trunk.\n";
|
||||
|
||||
const pr = await github.rest.pulls.create( {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: "Bump WP Version to L-2 compatible for trunk",
|
||||
head: "WP-L-2-version-support-${{ steps.l2Version.outputs.version }}/trunk",
|
||||
base: "trunk",
|
||||
body: PRBody
|
||||
} );
|
||||
|
||||
if ( pr.status != 201 ) {
|
||||
core.setFailed( "Unable to push WP-L-2-version-support-${{ steps.l2Version.outputs.version }}/trunk to GitHub." );
|
||||
}
|
||||
|
||||
await github.rest.pulls.requestReviewers( {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: pr.data.number,
|
||||
reviewers: [ context.actor ]
|
||||
} );
|
|
@ -0,0 +1,46 @@
|
|||
name: 'Changelog Auto Add'
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, synchronize, reopened, edited]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
prNumber:
|
||||
description: Pull request number
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
add-changelog:
|
||||
name: 'Add changelog to PR'
|
||||
if: ${{ github.event.pull_request.user.login != 'github-actions[bot]' }}
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd
|
||||
with:
|
||||
version: '8.6.7'
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: pnpm
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install prerequisites
|
||||
run: |
|
||||
pnpm install --filter monorepo-utils --ignore-scripts
|
||||
# ignore scripts speeds up setup signficantly, but we still need to build monorepo utils
|
||||
pnpm build
|
||||
working-directory: tools/monorepo-utils
|
||||
|
||||
- name: Add changelog
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: pnpm utils changefile ${{github.event.number || inputs.prNumber}} -o ${{ github.repository_owner }}
|
|
@ -336,7 +336,7 @@ jobs:
|
|||
uses: archive/github-actions-slack@v2.0.0
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.CODE_FREEZE_BOT_TOKEN }}
|
||||
slack-channel: ${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_CHANNEL }}
|
||||
slack-channel: ${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_NOTIFICATION_CHANNEL }}
|
||||
slack-text: |
|
||||
:warning-8c: Code freeze violation. PR(s) created that breaks the Code Freeze for '${{ needs.prep.outputs.release }}' :ice_cube:
|
||||
|
||||
|
@ -347,7 +347,7 @@ jobs:
|
|||
uses: archive/github-actions-slack@v2.0.0
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.CODE_FREEZE_BOT_TOKEN }}
|
||||
slack-channel: ${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_CHANNEL }}
|
||||
slack-channel: ${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_NOTIFICATION_CHANNEL }}
|
||||
slack-text: |
|
||||
:warning-8c: Code freeze violation. PR(s) created that breaks the Code Freeze for '${{ needs.prep.outputs.release }}' :ice_cube:
|
||||
|
||||
|
|
|
@ -1,82 +1,90 @@
|
|||
name: Run CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- trunk
|
||||
- 'release/**'
|
||||
workflow_dispatch:
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- trunk
|
||||
- 'release/**'
|
||||
workflow_dispatch:
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
run:
|
||||
shell: bash
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: [ '7.4', '8.0' ]
|
||||
wp: [ 'latest' ]
|
||||
include:
|
||||
- wp: nightly
|
||||
php: '7.4'
|
||||
- wp: '5.9'
|
||||
php: 7.4
|
||||
- wp: '5.8'
|
||||
php: 7.4
|
||||
services:
|
||||
database:
|
||||
image: mysql:5.6
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
ports:
|
||||
- 3306:3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
test:
|
||||
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }} - ${{ matrix.unittests }}
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ['7.4', '8.0']
|
||||
wp: ['latest']
|
||||
unittests: ['shard1', 'shard2']
|
||||
include:
|
||||
- wp: nightly
|
||||
php: '7.4'
|
||||
unittests: 'shard1'
|
||||
- wp: nightly
|
||||
php: '7.4'
|
||||
unittests: 'shard2'
|
||||
- wp: '6.1'
|
||||
php: 7.4
|
||||
unittests: 'shard1'
|
||||
- wp: '6.1'
|
||||
php: 7.4
|
||||
unittests: 'shard2'
|
||||
services:
|
||||
database:
|
||||
image: mysql:5.6
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
ports:
|
||||
- 3306:3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
build-filters: woocommerce
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
build-filters: woocommerce
|
||||
|
||||
- name: Tool versions
|
||||
run: |
|
||||
php --version
|
||||
composer --version
|
||||
- name: Tool versions
|
||||
run: |
|
||||
php --version
|
||||
composer --version
|
||||
|
||||
- name: Build Admin feature config
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm run build:feature-config
|
||||
- name: Build Admin feature config
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm run build:feature-config
|
||||
|
||||
- name: Add PHP8 Compatibility.
|
||||
run: |
|
||||
if [ "$(php -r "echo version_compare(PHP_VERSION,'8.0','>=');")" ]; then
|
||||
cd plugins/woocommerce
|
||||
curl -L https://github.com/woocommerce/phpunit/archive/add-compatibility-with-php8-to-phpunit-7.zip -o /tmp/phpunit-7.5-fork.zip
|
||||
unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip
|
||||
composer bin phpunit config --unset platform
|
||||
composer bin phpunit config repositories.0 '{"type": "path", "url": "/tmp/phpunit-7.5-fork/phpunit-add-compatibility-with-php8-to-phpunit-7", "options": {"symlink": false}}'
|
||||
composer bin phpunit require --dev -W phpunit/phpunit:@dev --ignore-platform-reqs
|
||||
rm -rf ./vendor/phpunit/
|
||||
composer dump-autoload
|
||||
fi
|
||||
- id: parseMatrix
|
||||
name: Parse Matrix Variables
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const parseWPVersion = require( './.github/workflows/scripts/parse-wp-version' );
|
||||
parseWPVersion( '${{ matrix.wp }}' ).then( ( version ) => {
|
||||
core.setOutput( 'wpVersion', version );
|
||||
} );
|
||||
|
||||
- name: Init DB and WP
|
||||
working-directory: plugins/woocommerce
|
||||
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 ${{ matrix.wp }}
|
||||
- name: Prepare Testing Environment
|
||||
env:
|
||||
WP_ENV_CORE: ${{ steps.parseMatrix.outputs.wpVersion }}
|
||||
WP_ENV_PHP_VERSION: ${{ matrix.php }}
|
||||
run: pnpm --filter=woocommerce env:test
|
||||
|
||||
- name: Run tests
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm run test --color
|
||||
- name: Run Tests
|
||||
env:
|
||||
WP_ENV_CORE: ${{ steps.parseMatrix.outputs.wpVersion }}
|
||||
WP_ENV_PHP_VERSION: ${{ matrix.php }}
|
||||
run: pnpm --filter=woocommerce test:unit:env --testsuite ${{ matrix.unittests }}
|
||||
|
|
|
@ -173,7 +173,7 @@ jobs:
|
|||
return await script( { core } )
|
||||
|
||||
- name: Find PR comment by github-actions[bot]
|
||||
uses: peter-evans/find-comment@v2
|
||||
uses: peter-evans/find-comment@034abe94d3191f9c89d870519735beae326f2bdb
|
||||
id: find-comment
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
|
@ -181,7 +181,7 @@ jobs:
|
|||
body-includes: Test Results Summary
|
||||
|
||||
- name: Create or update PR comment
|
||||
uses: peter-evans/create-or-update-comment@v2
|
||||
uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d
|
||||
with:
|
||||
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
|
||||
name: Run tests against PR
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '!**'
|
||||
- '**/changelog/**'
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo "No build required"'
|
|
@ -136,6 +136,7 @@ jobs:
|
|||
|
||||
k6-tests-run:
|
||||
name: Runs k6 Performance tests
|
||||
if: github.event.pull_request.user.login != 'github-actions[bot]'
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
|
@ -166,6 +167,7 @@ jobs:
|
|||
if: |
|
||||
always() &&
|
||||
! github.event.pull_request.head.repo.fork &&
|
||||
github.event.pull_request.user.login != 'github-actions[bot]' &&
|
||||
(
|
||||
contains( needs.*.result, 'success' ) ||
|
||||
contains( needs.*.result, 'failure' )
|
||||
|
@ -218,7 +220,7 @@ jobs:
|
|||
return await script( { core } )
|
||||
|
||||
- name: Find PR comment by github-actions[bot]
|
||||
uses: peter-evans/find-comment@v2
|
||||
uses: peter-evans/find-comment@034abe94d3191f9c89d870519735beae326f2bdb
|
||||
id: find-comment
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
|
@ -226,7 +228,7 @@ jobs:
|
|||
body-includes: Test Results Summary
|
||||
|
||||
- name: Create or update PR comment
|
||||
uses: peter-evans/create-or-update-comment@v2
|
||||
uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d
|
||||
with:
|
||||
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
|
@ -238,6 +240,7 @@ jobs:
|
|||
if: |
|
||||
always() &&
|
||||
! github.event.pull_request.head.repo.fork &&
|
||||
github.event.pull_request.user.login != 'github-actions[bot]' &&
|
||||
(
|
||||
contains( needs.*.result, 'success' ) ||
|
||||
contains( needs.*.result, 'failure' )
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
|
||||
name: Build Live Branch
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '!**'
|
||||
- '**/changelog/**'
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo "No build required"'
|
|
@ -13,7 +13,7 @@ permissions: {}
|
|||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository_owner == 'woocommerce'
|
||||
if: github.repository_owner == 'woocommerce' && github.event.pull_request.user.login != 'github-actions[bot]'
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
|
||||
name: Run code coverage on PR
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '!**'
|
||||
- '**/changelog/**'
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo "No build required"'
|
|
@ -1,60 +0,0 @@
|
|||
name: Run code coverage on PR
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/changelog/**'
|
||||
workflow_dispatch:
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Code coverage (PHP 7.4, WP Latest)
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
services:
|
||||
database:
|
||||
image: mysql:5.6
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
ports:
|
||||
- 3306:3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 100
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
|
||||
- name: Tool versions
|
||||
run: |
|
||||
php --version
|
||||
composer --version
|
||||
|
||||
- name: Build Admin feature config
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm run build:feature-config
|
||||
|
||||
- name: Init DB and WP
|
||||
working-directory: plugins/woocommerce
|
||||
run: bash tests/bin/install.sh woo_test root root 127.0.0.1 latest
|
||||
|
||||
- name: Run unit tests with code coverage. Allow to fail.
|
||||
working-directory: plugins/woocommerce
|
||||
run: |
|
||||
RUN_CODE_COVERAGE=1 bash tests/bin/phpunit.sh
|
||||
exit 0
|
||||
|
||||
- name: Send code coverage to Codecov.
|
||||
run: |
|
||||
bash <(curl -s https://codecov.io/bash)
|
|
@ -1,12 +0,0 @@
|
|||
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
|
||||
name: Run code coverage on PR
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '!**'
|
||||
- '**/changelog/**'
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo "No build required"'
|
|
@ -9,8 +9,6 @@ defaults:
|
|||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
env:
|
||||
PHPCS: ./plugins/woocommerce/vendor/bin/phpcs # Run WooCommerce phpcs setup in phpcs-changed instead of default
|
||||
|
||||
permissions: {}
|
||||
|
||||
|
@ -30,6 +28,7 @@ jobs:
|
|||
id: changed-files
|
||||
uses: tj-actions/changed-files@v32
|
||||
with:
|
||||
path: plugins/woocommerce
|
||||
files: |
|
||||
**/*.php
|
||||
|
||||
|
@ -41,6 +40,7 @@ jobs:
|
|||
|
||||
- name: Tool versions
|
||||
if: steps.changed-files.outputs.any_changed == 'true'
|
||||
working-directory: plugins/woocommerce
|
||||
run: |
|
||||
php --version
|
||||
composer --version
|
||||
|
@ -48,6 +48,7 @@ jobs:
|
|||
|
||||
- name: Run PHPCS
|
||||
if: steps.changed-files.outputs.any_changed == 'true'
|
||||
working-directory: plugins/woocommerce
|
||||
run: |
|
||||
HEAD_REF=$(git rev-parse HEAD)
|
||||
git checkout $HEAD_REF
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
|
||||
name: Highlight templates changes
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '!**'
|
||||
- '**/changelog/**'
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo "No build required"'
|
|
@ -8,6 +8,7 @@ permissions: {}
|
|||
|
||||
jobs:
|
||||
analyze:
|
||||
if: ${{ github.event.pull_request.user.login != 'github-actions[bot]' }}
|
||||
name: Check pull request changes to highlight
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
|
@ -20,8 +21,8 @@ jobs:
|
|||
- name: Install prerequisites
|
||||
run: |
|
||||
npm install -g pnpm
|
||||
npm -g i @wordpress/env@5.1.0
|
||||
pnpm install --filter code-analyzer --filter cli-core
|
||||
npm -g i @wordpress/env@8.0.0
|
||||
pnpm install --filter code-analyzer --filter monorepo-utils
|
||||
- name: Run analyzer
|
||||
id: run
|
||||
working-directory: tools/code-analyzer
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
name: Lint packages
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/changelog/**'
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
lint-test-js:
|
||||
name: Lint
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
# This is required to allow the action to annotate the PR with the linting results.
|
||||
checks: write
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd
|
||||
with:
|
||||
version: '8.6.7'
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: pnpm
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install prerequisites
|
||||
run: |
|
||||
# ignore scripts is faster, and postinstall should not be needed for lint.
|
||||
pnpm install --ignore-scripts
|
||||
|
||||
- name: Lint JS and CSS
|
||||
run: pnpm run -r --filter='release-posts' --filter='woocommerce/client/admin...' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/e2e*' --filter='!@woocommerce/api' --color lint
|
||||
|
||||
- name: Collect and Combine Eslint Reports
|
||||
if: ${{ github.event.pull_request.head.repo.fork != true && always() }}
|
||||
run: node ./.github/workflows/scripts/collect-eslint-reports.js
|
||||
|
||||
- name: Annotate Code Linting Results
|
||||
uses: ataylorme/eslint-annotate-action@a1bf7cb320a18aa53cb848a267ce9b7417221526
|
||||
if: ${{ github.event.pull_request.head.repo.fork != true && always() }}
|
||||
with:
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
report-json: 'combined_eslint_report.json'
|
|
@ -0,0 +1,64 @@
|
|||
name: MarkdownLint on PR
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/changelog/**'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v37
|
||||
with:
|
||||
files: |
|
||||
**/*.md
|
||||
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd
|
||||
with:
|
||||
version: '8.6.7'
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: pnpm
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install prerequisites
|
||||
run: |
|
||||
pnpm i -g markdownlint-cli
|
||||
|
||||
- name: Lint changed markdown files
|
||||
run: |
|
||||
RED="\e[1;31m"
|
||||
GREEN="\e[1;32m"
|
||||
NC="\e[0m"
|
||||
set -e
|
||||
rc=0
|
||||
changed_files="${{ steps.changed-files.outputs.all_changed_files }}"
|
||||
if [ -n "$changed_files" ]; then
|
||||
lint_results=""
|
||||
for file in $changed_files; do
|
||||
lint_result=$( { cat "$file" | markdownlint --stdin ; } 2>&1 ) || rc="$?"
|
||||
if [ $rc -ne 0 ]; then
|
||||
lint_results="$lint_results\n>>>Linting failed for file: $file <<<\n$lint_result\n--------"
|
||||
fi
|
||||
done
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo -e "${RED}Linting failed for one or more files${NC}"
|
||||
echo -e "$lint_results"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${GREEN}Linting successful for all files.${NC}"
|
||||
fi
|
||||
else
|
||||
echo "No markdown files changed."
|
||||
fi
|
|
@ -1,29 +0,0 @@
|
|||
name: Lint and tests for JS packages and woocommerce-admin/client
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/changelog/**'
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
lint-test-js:
|
||||
name: Lint and Test JS
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
|
||||
- name: Lint
|
||||
run: pnpm run -r --filter='release-posts' --filter='woocommerce/client/admin...' --filter='!@woocommerce/e2e*' --filter='!@woocommerce/api' --color lint
|
||||
|
||||
- name: Test
|
||||
run: pnpm run test --filter='woocommerce/client/admin...' --filter='!@woocommerce/e2e*' --filter='!@woocommerce/api' --color
|
|
@ -1,12 +0,0 @@
|
|||
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
|
||||
name: Run smoke tests against pull request.
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '!**'
|
||||
- '**/changelog/**'
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo "No build required"'
|
|
@ -1,12 +0,0 @@
|
|||
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
|
||||
name: Lint and tests for JS packages and woocommerce-admin/client
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '!**'
|
||||
- '**/changelog/**'
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo "No build required"'
|
|
@ -0,0 +1,40 @@
|
|||
name: Run tests for JS packages and woocommerce-admin/client
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/changelog/**'
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
test-js:
|
||||
name: Run JS Tests
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd
|
||||
with:
|
||||
version: '8.6.7'
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: pnpm
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install prerequisites
|
||||
run: |
|
||||
# ignore scripts is faster, and postinstall should not be needed for tests.
|
||||
pnpm install --ignore-scripts
|
||||
|
||||
- name: Test
|
||||
run: pnpm run test --filter='woocommerce/client/admin...' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/e2e*' --filter='@woocommerce/monorepo-utils' --filter='!@woocommerce/api' --color
|
|
@ -0,0 +1,24 @@
|
|||
name: Run unit for other PHP plugins
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/changelog/**'
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
php-version: '8.0'
|
||||
|
||||
- name: Run WooCommerce Docs Tests
|
||||
run: pnpm test:unit
|
||||
working-directory: ./plugins/woocommerce-docs
|
|
@ -1,12 +0,0 @@
|
|||
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
|
||||
name: Run unit tests on PR
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '!**'
|
||||
- '**/changelog/**'
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo "No build required"'
|
|
@ -13,50 +13,77 @@ concurrency:
|
|||
permissions: {}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: [ '7.4', '8.0' ]
|
||||
wp: [ "latest" ]
|
||||
include:
|
||||
- wp: nightly
|
||||
php: '7.4'
|
||||
- wp: '6.0'
|
||||
php: 7.4
|
||||
- wp: '5.9'
|
||||
php: 7.4
|
||||
services:
|
||||
database:
|
||||
image: mysql:5.6
|
||||
test:
|
||||
if: ${{ github.event.pull_request.user.login != 'github-actions[bot]' }}
|
||||
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }} - ${{ matrix.unittests }} ${{ matrix.hpos && 'HPOS' || '' }}
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
continue-on-error: ${{ matrix.wp == 'nightly' }}
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
ports:
|
||||
- 3306:3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
HPOS: ${{ matrix.hpos }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ['7.4', '8.0']
|
||||
wp: ['latest']
|
||||
unittests: ['shard1', 'shard2']
|
||||
include:
|
||||
- wp: nightly
|
||||
php: '7.4'
|
||||
unittests: 'shard1'
|
||||
- wp: nightly
|
||||
php: '7.4'
|
||||
unittests: 'shard2'
|
||||
- wp: '6.1'
|
||||
php: 7.4
|
||||
unittests: 'shard1'
|
||||
- wp: '6.1'
|
||||
php: 7.4
|
||||
unittests: 'shard2'
|
||||
- wp: 'latest'
|
||||
php: '7.4'
|
||||
hpos: true
|
||||
unittests: 'shard1'
|
||||
- wp: 'latest'
|
||||
php: '7.4'
|
||||
hpos: true
|
||||
unittests: 'shard2'
|
||||
services:
|
||||
database:
|
||||
image: mysql:5.6
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
ports:
|
||||
- 3306:3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
|
||||
- name: Tool versions
|
||||
run: |
|
||||
php --version
|
||||
composer --version
|
||||
- id: parseMatrix
|
||||
name: Parse Matrix Variables
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const parseWPVersion = require( './.github/workflows/scripts/parse-wp-version' );
|
||||
parseWPVersion( '${{ matrix.wp }}' ).then( ( version ) => {
|
||||
core.setOutput( 'wpVersion', version );
|
||||
} );
|
||||
|
||||
- name: Init DB and WP
|
||||
working-directory: plugins/woocommerce
|
||||
run: ./tests/bin/install.sh woo_test root root 127.0.0.1 ${{ matrix.wp }}
|
||||
- name: Prepare Testing Environment
|
||||
env:
|
||||
WP_ENV_CORE: ${{ steps.parseMatrix.outputs.wpVersion }}
|
||||
WP_ENV_PHP_VERSION: ${{ matrix.php }}
|
||||
run: pnpm --filter=woocommerce env:test
|
||||
|
||||
- name: Run tests
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm run test --filter=woocommerce --color
|
||||
- name: Run Tests
|
||||
env:
|
||||
WP_ENV_CORE: ${{ steps.parseMatrix.outputs.wpVersion }}
|
||||
WP_ENV_PHP_VERSION: ${{ matrix.php }}
|
||||
run: pnpm --filter=woocommerce test:unit:env --testsuite ${{ matrix.unittests }}
|
||||
|
|
|
@ -3,7 +3,7 @@ on:
|
|||
workflow_dispatch:
|
||||
inputs:
|
||||
packages:
|
||||
description: 'Enter a specific package to release, or packages separated by commas, ie @woocommerce/components,@woocommerce/number. Leaving this input to the default "-a" will prepare to release all eligible packages. When releasing a package for the first time, pass the "--initialRelease" flag.'
|
||||
description: 'Enter a specific package to release, or packages separated by commas, ie @woocommerce/components,@woocommerce/number. Leaving this input to the default "-a" will prepare to release all eligible packages.'
|
||||
required: false
|
||||
default: '-a'
|
||||
|
||||
|
@ -18,6 +18,8 @@ jobs:
|
|||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
|
|
|
@ -45,3 +45,26 @@ jobs:
|
|||
env:
|
||||
PULL_REQUEST_ID: ${{ github.event.pull_request.node_id }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: 'Add the label for PR analysis'
|
||||
if: |
|
||||
github.event.pull_request.base.ref == 'trunk' &&
|
||||
! contains(github.event.pull_request.labels.*.name, 'status: analysis complete')
|
||||
uses: actions-ecosystem/action-add-labels@bd52874380e3909a1ac983768df6976535ece7f8
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
labels: 'needs: analysis'
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
sparse-checkout: |
|
||||
.github/actions/pr-scrub-notify-slack
|
||||
ref: trunk
|
||||
- name: 'Trigger PR scrub'
|
||||
if: |
|
||||
github.event.pull_request.base.ref == 'trunk' &&
|
||||
! contains(github.event.pull_request.labels.*.name, 'needs: analysis') &&
|
||||
! contains(github.event.pull_request.labels.*.name, 'status: analysis complete')
|
||||
uses: ./.github/actions/pr-scrub-notify-slack
|
||||
with:
|
||||
TEST_ASSISTANCE_BOT_TOKEN: ${{ secrets.TEST_ASSISTANCE_BOT_TOKEN }}
|
||||
WOO_PR_TESTING_ANALYSIS_SLACK_CHANNEL: ${{ secrets.WOO_PR_TESTING_ANALYSIS_SLACK_CHANNEL }}
|
||||
WOO_PR_TESTING_ANALYSIS_TEAM_ID: ${{ secrets.WOO_PR_TESTING_ANALYSIS_TEAM_ID }}
|
||||
|
|
|
@ -1,119 +0,0 @@
|
|||
name: 'Release: Generate changelog'
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
releaseBranch:
|
||||
description: 'The name of the release branch, in the format `release/x.y`'
|
||||
required: true
|
||||
releaseVersion:
|
||||
description: 'The version of the release, in the format `x.y`'
|
||||
required: true
|
||||
|
||||
env:
|
||||
GIT_COMMITTER_NAME: 'WooCommerce Bot'
|
||||
GIT_COMMITTER_EMAIL: 'no-reply@woocommerce.com'
|
||||
GIT_AUTHOR_NAME: 'WooCommerce Bot'
|
||||
GIT_AUTHOR_EMAIL: 'no-reply@woocommerce.com'
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
create-changelog-prs:
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
build: false
|
||||
|
||||
- name: 'Git fetch the release branch'
|
||||
run: git fetch origin ${{ inputs.releaseBranch }}
|
||||
|
||||
- name: 'Checkout the release branch'
|
||||
run: git checkout ${{ inputs.releaseBranch }}
|
||||
|
||||
- name: 'Create a new branch for the changelog update PR'
|
||||
run: git checkout -b ${{ format( 'update/{0}-changelog', inputs.releaseVersion ) }}
|
||||
|
||||
- name: 'Generate the changelog file'
|
||||
run: pnpm --filter=woocommerce run changelog write --add-pr-num -n -vvv --use-version ${{ inputs.releaseVersion }}
|
||||
|
||||
- name: Checkout pnpm-lock.yaml to prevent issues
|
||||
run: git checkout pnpm-lock.yaml
|
||||
|
||||
- name: 'git rm deleted files'
|
||||
run: git rm $(git ls-files --deleted)
|
||||
|
||||
- name: 'Commit deletion'
|
||||
run: git commit -m "Delete changelog files from ${{ inputs.releaseVersion }} release"
|
||||
|
||||
- name: 'Remember the deletion commit hash'
|
||||
id: rev-parse
|
||||
run: echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: 'Insert NEXT_CHANGELOG contents into readme.txt'
|
||||
run: php .github/workflows/scripts/release-changelog.php
|
||||
|
||||
- name: 'git add readme.txt'
|
||||
run: git add plugins/woocommerce/readme.txt
|
||||
|
||||
- name: 'Commit readme'
|
||||
run: git commit -m "Update the readme files for the ${{ inputs.releaseVersion }} release"
|
||||
|
||||
- name: 'Push update branch to origin'
|
||||
run: git push origin ${{ format( 'update/{0}-changelog', inputs.releaseVersion ) }}
|
||||
|
||||
- name: 'Stash any other undesired changes'
|
||||
run: git stash
|
||||
|
||||
- name: 'Checkout trunk'
|
||||
run: git checkout trunk
|
||||
|
||||
- name: 'Create a branch for the changelog files deletion'
|
||||
run: git checkout -b ${{ format( 'delete/{0}-changelog', inputs.releaseVersion ) }}
|
||||
|
||||
- name: 'Cherry-pick the deletion commit'
|
||||
run: git cherry-pick ${{ steps.rev-parse.outputs.hash }}
|
||||
|
||||
- name: 'Push deletion branch to origin'
|
||||
run: git push origin ${{ format( 'delete/{0}-changelog', inputs.releaseVersion ) }}
|
||||
|
||||
- name: 'Create release branch PR'
|
||||
id: release-pr
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const result = await github.rest.pulls.create( {
|
||||
owner: "${{ github.repository_owner }}",
|
||||
repo: "${{ github.event.repository.name }}",
|
||||
head: "${{ format( 'update/{0}-changelog', inputs.releaseVersion ) }}",
|
||||
base: "${{ inputs.releaseBranch }}",
|
||||
title: "${{ format( 'Release: Prepare the changelog for {0}', inputs.releaseVersion ) }}",
|
||||
body: "${{ format( 'This pull request was automatically generated during the code freeze to prepare the changelog for {0}', inputs.releaseVersion ) }}"
|
||||
} );
|
||||
|
||||
return result.data.number;
|
||||
|
||||
- name: 'Create trunk PR'
|
||||
id: trunk-pr
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const result = await github.rest.pulls.create( {
|
||||
owner: "${{ github.repository_owner }}",
|
||||
repo: "${{ github.event.repository.name }}",
|
||||
head: "${{ format( 'delete/{0}-changelog', inputs.releaseVersion ) }}",
|
||||
base: "trunk",
|
||||
title: "${{ format( 'Release: Remove {0} change files', inputs.releaseVersion ) }}",
|
||||
body: "${{ format( 'This pull request was automatically generated during the code freeze to remove the changefiles from {0} that are compiled into the `{1}` branch via #{2}', inputs.releaseVersion, inputs.releaseBranch, steps.release-pr.outputs.result ) }}"
|
||||
} );
|
||||
|
||||
return result.data.number;
|
|
@ -14,7 +14,7 @@ on:
|
|||
description: 'Slack Channel Override: The channel ID to send the Slack ping about the freeze'
|
||||
|
||||
env:
|
||||
TIME_OVERRIDE: ${{ inputs.timeOverride }}
|
||||
TIME_OVERRIDE: ${{ inputs.timeOverride || 'now' }}
|
||||
GIT_COMMITTER_NAME: 'WooCommerce Bot'
|
||||
GIT_COMMITTER_EMAIL: 'no-reply@woocommerce.com'
|
||||
GIT_AUTHOR_NAME: 'WooCommerce Bot'
|
||||
|
@ -23,157 +23,109 @@ env:
|
|||
permissions: {}
|
||||
|
||||
jobs:
|
||||
verify-code-freeze:
|
||||
name: 'Verify that today is the day of the code freeze'
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
freeze: ${{ steps.check-freeze.outputs.freeze }}
|
||||
steps:
|
||||
- name: 'Install PHP'
|
||||
uses: shivammathur/setup-php@8e2ac35f639d3e794c1da1f28999385ab6fdf0fc
|
||||
with:
|
||||
php-version: '7.4'
|
||||
|
||||
- name: 'Check whether today is the code freeze day'
|
||||
id: check-freeze
|
||||
shell: php {0}
|
||||
run: |
|
||||
<?php
|
||||
$now = time();
|
||||
if ( getenv( 'TIME_OVERRIDE' ) ) {
|
||||
$now = strtotime( getenv( 'TIME_OVERRIDE' ) );
|
||||
}
|
||||
|
||||
// Code freeze comes 22 days prior to release day.
|
||||
$release_time = strtotime( '+22 days', $now );
|
||||
$release_day_of_week = date( 'l', $release_time );
|
||||
$release_day_of_month = (int) date( 'j', $release_time );
|
||||
|
||||
// If 22 days from now isn't the second Tuesday, then it's not code freeze day.
|
||||
if ( 'Tuesday' !== $release_day_of_week || $release_day_of_month < 8 || $release_day_of_month > 14 ) {
|
||||
file_put_contents( getenv( 'GITHUB_OUTPUT' ), "freeze=1\n", FILE_APPEND );
|
||||
} else {
|
||||
file_put_contents( getenv( 'GITHUB_OUTPUT' ), "freeze=0\n", FILE_APPEND );
|
||||
}
|
||||
|
||||
maybe-create-next-milestone-and-release-branch:
|
||||
name: 'Maybe create next milestone and release branch'
|
||||
code-freeze-prep:
|
||||
name: 'Verify that today is the day of the code freeze and prepare repository'
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
needs: verify-code-freeze
|
||||
if: needs.verify-code-freeze.outputs.freeze == 0
|
||||
pull-requests: write
|
||||
outputs:
|
||||
branch: ${{ steps.freeze.outputs.branch }}
|
||||
release_version: ${{ steps.freeze.outputs.release_version }}
|
||||
next_version: ${{ steps.freeze.outputs.next_version }}
|
||||
freeze: ${{ steps.check-freeze.outputs.freeze }}
|
||||
nextReleaseBranch: ${{ steps.branch.outputs.nextReleaseBranch }}
|
||||
nextReleaseVersion: ${{ steps.milestone.outputs.nextReleaseVersion }}
|
||||
nextDevelopmentVersion: ${{ steps.milestone.outputs.nextDevelopmentVersion }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 100
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd
|
||||
with:
|
||||
build: false
|
||||
version: '8.6.7'
|
||||
|
||||
- name: 'Run the script to enforce the code freeze'
|
||||
id: freeze
|
||||
run: php .github/workflows/scripts/release-code-freeze.php
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: pnpm
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install prerequisites
|
||||
run: |
|
||||
pnpm install --filter monorepo-utils --ignore-scripts
|
||||
# ignore scripts speeds up setup signficantly, but we still need to build monorepo utils
|
||||
pnpm build
|
||||
working-directory: tools/monorepo-utils
|
||||
|
||||
- name: 'Check whether today is the code freeze day'
|
||||
id: check-freeze
|
||||
run: pnpm utils code-freeze verify-day -o $TIME_OVERRIDE
|
||||
|
||||
- name: Create next milestone
|
||||
id: milestone
|
||||
if: steps.check-freeze.outputs.freeze == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_OUTPUTS: 1
|
||||
run: pnpm run utils code-freeze milestone -o ${{ github.repository_owner }}
|
||||
|
||||
prep-trunk:
|
||||
name: Preps trunk for next development cycle
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
needs: maybe-create-next-milestone-and-release-branch
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 100
|
||||
- name: Create next release branch
|
||||
id: branch
|
||||
if: steps.check-freeze.outputs.freeze == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: pnpm run utils code-freeze branch -o ${{ github.repository_owner }}
|
||||
|
||||
- name: fetch-trunk
|
||||
run: git fetch origin trunk
|
||||
- name: Prepare trunk for next development cycle
|
||||
id: prep-trunk
|
||||
if: steps.check-freeze.outputs.freeze == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: pnpm run utils code-freeze version-bump ${{ steps.milestone.outputs.nextDevelopmentVersion }}.0-dev -o ${{ github.repository_owner }}
|
||||
|
||||
- name: checkout-trunk
|
||||
run: git checkout trunk
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
|
||||
- name: Create branch
|
||||
run: git checkout -b prep/trunk-for-next-dev-cycle-${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }}
|
||||
|
||||
- name: Bump versions
|
||||
working-directory: ./tools/version-bump
|
||||
run: pnpm run version bump woocommerce -v ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }}.0-dev
|
||||
|
||||
- name: Checkout pnpm-lock.yaml to prevent issues
|
||||
run: git checkout pnpm-lock.yaml
|
||||
|
||||
- name: Commit changes
|
||||
run: git commit -am "Prep trunk for ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }} cycle"
|
||||
|
||||
- name: Push branch up
|
||||
run: git push --no-verify origin prep/trunk-for-next-dev-cycle-${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }}
|
||||
|
||||
- name: Create the PR
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const body = "This PR updates the versions in trunk to ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }} for next development cycle."
|
||||
|
||||
const pr = await github.rest.pulls.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: "Prep trunk for ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }} cycle",
|
||||
head: "prep/trunk-for-next-dev-cycle-${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }}",
|
||||
base: "trunk",
|
||||
body: body
|
||||
})
|
||||
- name: Generate changelog changes
|
||||
id: changelog
|
||||
if: steps.check-freeze.outputs.freeze == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: pnpm run utils code-freeze changelog -o ${{ github.repository_owner }} -v ${{ steps.milestone.outputs.nextReleaseVersion }}
|
||||
|
||||
notify-slack:
|
||||
name: 'Sends code freeze notification to Slack'
|
||||
if: ${{ inputs.skipSlackPing != true }}
|
||||
runs-on: ubuntu-20.04
|
||||
needs: maybe-create-next-milestone-and-release-branch
|
||||
needs: code-freeze-prep
|
||||
if: ${{ needs.code-freeze-prep.outputs.freeze == 'true' && inputs.skipSlackPing != true }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd
|
||||
with:
|
||||
version: '8.6.7'
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: pnpm
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install prerequisites
|
||||
run: |
|
||||
pnpm install --filter monorepo-utils --ignore-scripts
|
||||
# ignore scripts speeds up setup signficantly, but we still need to build monorepo utils
|
||||
pnpm build
|
||||
working-directory: tools/monorepo-utils
|
||||
|
||||
- name: Slack
|
||||
uses: archive/github-actions-slack@v2.0.0
|
||||
id: notify
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.CODE_FREEZE_BOT_TOKEN }}
|
||||
slack-channel: ${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
:warning-8c: ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.release_version }} Code Freeze :ice_cube:
|
||||
|
||||
The automation to cut the release branch for ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.release_version }} has run. Any PRs that were not already merged will be a part of ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.next_version }} by default. If you have something that needs to make ${{ needs.maybe-create-next-milestone-and-release-branch.outputs.release_version }} that hasn't yet been merged, please see the <${{ secrets.FG_LINK }}/code-freeze-for-woocommerce-core-release/|fieldguide page for the code freeze>.
|
||||
|
||||
trigger-changelog-action:
|
||||
name: 'Trigger changelog action'
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
actions: write
|
||||
needs: maybe-create-next-milestone-and-release-branch
|
||||
steps:
|
||||
- name: 'Trigger changelog action'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
github.rest.actions.createWorkflowDispatch({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
workflow_id: 'release-changelog.yml',
|
||||
ref: 'trunk',
|
||||
inputs: {
|
||||
releaseVersion: "${{ needs.maybe-create-next-milestone-and-release-branch.outputs.release_version }}",
|
||||
releaseBranch: "${{ needs.maybe-create-next-milestone-and-release-branch.outputs.branch }}"
|
||||
}
|
||||
})
|
||||
run: |
|
||||
pnpm utils slack "${{ secrets.CODE_FREEZE_BOT_TOKEN }}" "
|
||||
:warning-8c: ${{ needs.code-freeze-prep.outputs.nextReleaseVersion }} Code Freeze :ice_cube:
|
||||
The automation to cut the release branch for ${{ needs.code-freeze-prep.outputs.nextReleaseVersion }} has run. Any PRs that were not already merged will be a part of ${{ needs.code-freeze-prep.outputs.nextDevelopmentVersion }} by default. If you have something that needs to make ${{ needs.code-freeze-prep.outputs.nextReleaseVersion }} that hasn't yet been merged, please see the <${{ secrets.FG_LINK }}/code-freeze-for-woocommerce-core-release/|fieldguide page for the code freeze>.
|
||||
" "${{ inputs.slackChannelOverride || secrets.WOO_RELEASE_SLACK_CHANNEL }}"
|
||||
|
|
|
@ -20,6 +20,10 @@ jobs:
|
|||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
|
||||
- name: Lint
|
||||
working-directory: plugins/woocommerce-beta-tester
|
||||
run: composer run phpcs
|
||||
|
||||
- name: Build WooCommerce Beta Tester Zip
|
||||
working-directory: plugins/woocommerce-beta-tester
|
||||
run: pnpm build:zip
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
name: Remind reviewers to also review the testing instructions.
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [review_requested]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
add-testing-instructions-review-comment:
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
||||
|
||||
- name: Install Octokit
|
||||
run: npm --prefix .github/workflows/scripts install @octokit/action
|
||||
|
||||
- name: Install Actions Core
|
||||
run: npm --prefix .github/workflows/scripts install @actions/core
|
||||
|
||||
- name: Check if user is a community contributor
|
||||
id: is-community-contributor
|
||||
run: node .github/workflows/scripts/is-community-contributor.js
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Get the username of requested reviewers
|
||||
if: steps.is-community-contributor.outputs.is-community == 'no'
|
||||
id: get_reviewer_username
|
||||
run: |
|
||||
# Retrieves the username of all reviewers and stores them in a comma-separated list
|
||||
reviewers=$(echo '${{ toJson(github.event.pull_request.requested_reviewers[*].login) }}' | jq -r 'map("@\(.)") | join(", ")')
|
||||
echo "REVIEWERS=$reviewers" >> $GITHUB_ENV
|
||||
|
||||
- name: Get the name of requested teams
|
||||
id: get_team_name
|
||||
run: |
|
||||
# Retrieves the name of all teams asked for review and stores them in a comma-separated list
|
||||
teams=$(echo '${{ toJson(github.event.pull_request.requested_teams[*].slug) }}' | jq -r 'map("@woocommerce/\(.)") | join(", ")')
|
||||
echo "TEAMS=$teams" >> $GITHUB_ENV
|
||||
|
||||
- name: Find the comment by github-actions[bot] asking for reviewing the testing instructions
|
||||
uses: peter-evans/find-comment@034abe94d3191f9c89d870519735beae326f2bdb
|
||||
id: find-comment
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
comment-author: 'github-actions[bot]'
|
||||
body-includes: please make sure to review the testing instructions
|
||||
|
||||
- name: Create or update PR comment asking for reviewers to review the testing instructions
|
||||
uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d
|
||||
with:
|
||||
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body: |
|
||||
Hi ${{ env.REVIEWERS }}, ${{ env.TEAMS }}
|
||||
|
||||
Apart from reviewing the code changes, please make sure to review the testing instructions as well.
|
||||
|
||||
You can follow this guide to find out what good testing instructions should look like:
|
||||
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions
|
||||
edit-mode: replace
|
|
@ -0,0 +1,34 @@
|
|||
const fs = require( 'fs' );
|
||||
const path = require( 'path' );
|
||||
|
||||
const rootDirectory = path.resolve( __dirname, '..', '..', '..' );
|
||||
|
||||
const allReports = [];
|
||||
|
||||
function collectReports( directory ) {
|
||||
const files = fs.readdirSync( directory );
|
||||
for ( const file of files ) {
|
||||
const fullPath = path.join( directory, file );
|
||||
const isDirectory = fs.statSync( fullPath ).isDirectory();
|
||||
|
||||
if ( isDirectory && file !== 'node_modules' && file !== 'vendor' ) {
|
||||
const reportPath = path.join( fullPath, 'eslint_report.json' );
|
||||
if ( fs.existsSync( reportPath ) ) {
|
||||
// an array of items
|
||||
const report = require( reportPath );
|
||||
|
||||
// add the report to the allReports array
|
||||
allReports.push( ...report );
|
||||
}
|
||||
|
||||
collectReports( fullPath );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
collectReports( rootDirectory );
|
||||
|
||||
fs.writeFileSync(
|
||||
'combined_eslint_report.json',
|
||||
JSON.stringify( allReports, null, 2 )
|
||||
);
|
|
@ -0,0 +1,89 @@
|
|||
const https = require( 'http' );
|
||||
|
||||
/**
|
||||
For convenience, this method will convert between a display-friendly version format and one used
|
||||
internally by wp-env. We lean towards using WordPress.org ZIPs which requires us to reference
|
||||
the full URL to the archive. For instance, instead of needing the action to fully define the
|
||||
URL to the nightly build we can pass "nightly" to this function and retrieve it.
|
||||
|
||||
@param {string} wpVersion The display-friendly version. Supports ("master", "trunk", "nightly",
|
||||
"latest", "X.X" for version lines, and "X.X.X" for specific versions)
|
||||
@return {Promise.<string>} The wp-env "core" property".
|
||||
**/
|
||||
module.exports = async function parseWPVersion( wpVersion ) {
|
||||
// Start with versions we can infer immediately.
|
||||
switch ( wpVersion ) {
|
||||
case 'master':
|
||||
case 'trunk': {
|
||||
return 'WordPress/WordPress#master';
|
||||
}
|
||||
|
||||
case 'nightly': {
|
||||
return 'https://wordpress.org/nightly-builds/wordpress-latest.zip';
|
||||
}
|
||||
|
||||
case 'latest': {
|
||||
return 'https://wordpress.org/latest.zip';
|
||||
}
|
||||
}
|
||||
|
||||
return new Promise( ( resolve, reject ) => {
|
||||
// We're going to download the correct zip archive based on the version they're requesting.
|
||||
const parsedVersion = wpVersion.match( /([0-9]+)\.([0-9]+)(?:\.([0-9]+))?/ );
|
||||
if ( ! parsedVersion ) {
|
||||
throw new Error( `Invalid 'wp-version': ${ wpVersion } must be 'trunk', 'nightly', 'latest', 'X.X', or 'X.X.X'.` );
|
||||
}
|
||||
|
||||
// When they've provided a specific version we can just provide that.
|
||||
if ( parsedVersion[ 3 ] !== undefined ) {
|
||||
let zipVersion = `${ parsedVersion[ 1 ] }.${ parsedVersion[ 2 ] }`;
|
||||
// .0 versions do not have a patch.
|
||||
if ( parsedVersion[ 3 ] !== '0' ) {
|
||||
zipVersion += `.${ parsedVersion[ 3 ] }`;
|
||||
}
|
||||
|
||||
resolve( `https://wordpress.org/wordpress-${ zipVersion }.zip` );
|
||||
}
|
||||
|
||||
const request = https.get(
|
||||
'http://api.wordpress.org/core/stable-check/1.0/',
|
||||
( response ) => {
|
||||
// Listen for the response data.
|
||||
let data = '';
|
||||
response.on('data', (chunk) => {
|
||||
data += chunk;
|
||||
});
|
||||
|
||||
// Once we have the entire response we can process it.
|
||||
response.on('end', () => {
|
||||
// Parse the response and find the latest version of every minor release.
|
||||
const latestVersions = {};
|
||||
const rawVersions = JSON.parse( data );
|
||||
for ( const v in rawVersions ) {
|
||||
// Parse the version so we can find the latest.
|
||||
const matches = v.match( /([0-9]+)\.([0-9]+)(?:\.([0-9]+))?/ );
|
||||
const minor = `${ matches[1] }.${ matches[2] }`;
|
||||
const patch = matches[ 3 ] === undefined ? 0 : parseInt( matches[ 3 ] );
|
||||
|
||||
// We will only be keeping the latest release of each minor.
|
||||
if ( latestVersions[ minor ] === undefined || patch > latestVersions[ minor ] ) {
|
||||
latestVersions[ minor ] = patch;
|
||||
}
|
||||
}
|
||||
|
||||
let zipVersion = `${ parsedVersion[ 1 ] }.${ parsedVersion[ 2 ] }`;
|
||||
// .0 versions do not have a patch.
|
||||
if ( latestVersions[ zipVersion ] !== 0 ) {
|
||||
zipVersion += `.${ latestVersions[ zipVersion ]}`;
|
||||
}
|
||||
|
||||
resolve( `https://wordpress.org/wordpress-${ zipVersion }.zip` );
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
request.on( 'error', ( error ) => {
|
||||
reject( error );
|
||||
} );
|
||||
} );
|
||||
}
|
|
@ -135,7 +135,7 @@ function get_latest_version_with_release() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Function to retreive the sha1 reference for a given branch name.
|
||||
* Function to retrieve the sha1 reference for a given branch name.
|
||||
*
|
||||
* @param string $branch The name of the branch.
|
||||
* @return string Returns the name of the branch, or a falsey value on error.
|
||||
|
|
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
// phpcs:ignoreFile
|
||||
/**
|
||||
* Script to automatically enforce the release code freeze.
|
||||
*
|
||||
* @package WooCommerce/GithubActions
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/post-request-shared.php';
|
||||
|
||||
$now = time();
|
||||
if ( getenv( 'TIME_OVERRIDE' ) ) {
|
||||
$now = strtotime( getenv( 'TIME_OVERRIDE' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an output for the GitHub action.
|
||||
*
|
||||
* @param string $name The name of the output.
|
||||
* @param string $value The value of the output.
|
||||
*/
|
||||
function set_output( $name, $value ) {
|
||||
file_put_contents( getenv( 'GITHUB_OUTPUT' ), "{$name}={$value}" . PHP_EOL, FILE_APPEND );
|
||||
}
|
||||
|
||||
// Code freeze comes 22 days prior to release day.
|
||||
$release_time = strtotime( '+22 days', $now );
|
||||
$release_day_of_week = date( 'l', $release_time );
|
||||
$release_day_of_month = (int) date( 'j', $release_time );
|
||||
|
||||
// If 22 days from now isn't the second Tuesday, then it's not code freeze day.
|
||||
if ( 'Tuesday' !== $release_day_of_week || $release_day_of_month < 8 || $release_day_of_month > 14 ) {
|
||||
echo 'Info: Today is not the Monday of the code freeze.' . PHP_EOL;
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
$latest_version_with_release = get_latest_version_with_release();
|
||||
|
||||
if ( empty( $latest_version_with_release ) ) {
|
||||
echo '*** Error: Unable to get latest version with release' . PHP_EOL;
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
// Because we go from 5.9 to 6.0, we can get the next major_minor by adding 0.1 and formatting appropriately.
|
||||
$latest_float = (float) $latest_version_with_release;
|
||||
$branch_major_minor = number_format( $latest_float + 0.1, 1 );
|
||||
$milestone_major_minor = number_format( $latest_float + 0.2, 1 );
|
||||
|
||||
// We use those values to get the release branch and next milestones that we need to create.
|
||||
$release_branch_to_create = "release/{$branch_major_minor}";
|
||||
$milestone_to_create = "{$milestone_major_minor}.0";
|
||||
|
||||
if ( getenv( 'GITHUB_OUTPUTS' ) ) {
|
||||
echo 'Including GitHub Outputs...' . PHP_EOL;
|
||||
|
||||
set_output( 'next_version', $milestone_major_minor );
|
||||
set_output( 'release_version', $branch_major_minor );
|
||||
set_output( 'branch', $release_branch_to_create );
|
||||
set_output( 'milestone', $milestone_to_create );
|
||||
}
|
||||
|
||||
if ( getenv( 'DRY_RUN' ) ) {
|
||||
echo 'DRY RUN: Skipping actual creation of release branch and milestone...' . PHP_EOL;
|
||||
echo "Release Branch: {$release_branch_to_create}" . PHP_EOL;
|
||||
echo "Milestone: {$milestone_to_create}" . PHP_EOL;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( create_github_milestone( $milestone_to_create ) ) {
|
||||
echo "Created milestone {$milestone_to_create}" . PHP_EOL;
|
||||
} elseif ( '422' === $github_api_response_code ) {
|
||||
// The milestone already existed when GitHub returns a 422 status.
|
||||
echo "Notice: Unable to create {$milestone_to_create} milestone. Maybe it already exists? Skipping..." . PHP_EOL;
|
||||
} else {
|
||||
echo "*** Error: Unable to create {$milestone_to_create} milestone" . PHP_EOL;
|
||||
}
|
||||
|
||||
if ( create_github_branch_from_branch( 'trunk', $release_branch_to_create ) ) {
|
||||
echo "Created branch {$release_branch_to_create}" . PHP_EOL;
|
||||
} elseif ( '422' === $github_api_response_code ) {
|
||||
// The release branch already existed when GitHub returns a 422 status.
|
||||
echo "Notice: Unable to create {$release_branch_to_create} branch. Maybe it already exists? Skipping..." . PHP_EOL;
|
||||
exit( 1 );
|
||||
} else {
|
||||
echo "*** Error: Unable to create {$release_branch_to_create}" . PHP_EOL;
|
||||
exit( 1 );
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
#
|
||||
|
||||
cd $GITHUB_WORKSPACE/plugins/woocommerce
|
||||
ACTUAL_PHP_VERSION=$(pnpm exec wp-env run tests-cli "wp --info | grep 'PHP version:'")
|
||||
ACTUAL_PHP_VERSION=$(pnpm exec wp-env run tests-cli wp --info | grep 'PHP version:')
|
||||
EXIT_CODE=''
|
||||
|
||||
echo "PHP version found in WP Env environment: \"$ACTUAL_PHP_VERSION\""
|
||||
|
|
|
@ -25,6 +25,7 @@ jobs:
|
|||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-report
|
||||
BASE_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
API_BASE_URL: ${{ secrets.SMOKE_TEST_API_URL }}
|
||||
ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
||||
|
@ -48,14 +49,14 @@ jobs:
|
|||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
UPDATE_WC: nightly
|
||||
run: pnpm exec playwright test --config=tests/e2e-pw/daily.playwright.config.js update-woocommerce.spec.js
|
||||
run: pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js update-woocommerce.spec.js
|
||||
|
||||
- name: Run API tests.
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
USER_KEY: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
USER_SECRET: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
run: pnpm exec playwright test --config=tests/api-core-tests/playwright.config.js hello.test.js
|
||||
run: pnpm exec playwright test --config=tests/api-core-tests/playwright.config.js
|
||||
|
||||
- name: Generate API Test report.
|
||||
if: success() || failure()
|
||||
|
@ -78,7 +79,7 @@ jobs:
|
|||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
needs: [api-tests]
|
||||
# needs: [api-tests]
|
||||
env:
|
||||
ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
|
@ -200,15 +201,17 @@ jobs:
|
|||
- plugin: 'WooCommerce Subscriptions'
|
||||
repo: WC_SUBSCRIPTIONS_REPO
|
||||
private: true
|
||||
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
|
||||
repo: 'Yoast/wordpress-seo'
|
||||
- plugin: 'Contact Form 7'
|
||||
repo: 'takayukister/contact-form-7'
|
||||
- plugin: 'Gutenberg'
|
||||
repo: 'WordPress/gutenberg'
|
||||
- plugin: 'Gutenberg - Nightly'
|
||||
repo: 'bph/gutenberg'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
build-filters: woocommerce
|
||||
|
||||
- name: Launch wp-env e2e environment
|
||||
working-directory: plugins/woocommerce
|
||||
|
@ -224,13 +227,13 @@ jobs:
|
|||
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
|
||||
PLUGIN_NAME: ${{ matrix.plugin }}
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
run: pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js upload-plugin.spec.js
|
||||
run: pnpm test:e2e-pw upload-plugin.spec.js
|
||||
|
||||
- name: Run the rest of E2E tests
|
||||
working-directory: plugins/woocommerce
|
||||
env:
|
||||
E2E_MAX_FAILURES: 15
|
||||
run: pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js
|
||||
run: pnpm test:e2e-pw
|
||||
|
||||
- name: Generate E2E Test report.
|
||||
if: success() || failure()
|
||||
|
@ -321,36 +324,29 @@ jobs:
|
|||
matrix:
|
||||
include:
|
||||
- plugin: 'WooCommerce Payments'
|
||||
repo: 'automattic/woocommerce-payments'
|
||||
slug: woocommerce-payments
|
||||
- plugin: 'WooCommerce PayPal Payments'
|
||||
repo: 'woocommerce/woocommerce-paypal-payments'
|
||||
slug: woocommerce-paypal-payments
|
||||
- plugin: 'WooCommerce Shipping & Tax'
|
||||
repo: 'automattic/woocommerce-services'
|
||||
- plugin: 'WordPress SEO' # Yoast SEO in the UI, but the slug is wordpress-seo
|
||||
repo: 'Yoast/wordpress-seo'
|
||||
- plugin: 'Contact Form 7'
|
||||
repo: 'takayukister/contact-form-7'
|
||||
slug: woocommerce-services
|
||||
- plugin: 'WooCommerce Subscriptions'
|
||||
slug: woocommerce-subscriptions
|
||||
- plugin: 'Gutenberg'
|
||||
slug: gutenberg
|
||||
- plugin: 'Gutenberg - Nightly'
|
||||
slug: gutenberg-nightly
|
||||
steps:
|
||||
- name: Download test report artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.ARTIFACT }}
|
||||
|
||||
# TODO: Add step to post job summary
|
||||
|
||||
- name: Get slug
|
||||
id: get-slug
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
result-encoding: string
|
||||
script: return "${{ matrix.repo }}".split( '/' ).pop()
|
||||
|
||||
- name: Publish reports
|
||||
run: |
|
||||
gh workflow run publish-test-reports-daily-plugins.yml \
|
||||
-f run_id=$RUN_ID \
|
||||
-f artifact="${{ env.ARTIFACT }}" \
|
||||
-f plugin="${{ matrix.plugin }}" \
|
||||
-f slug="${{ steps.get-slug.outputs.result }}" \
|
||||
-f slug="${{ matrix.slug }}" \
|
||||
-f s3_root=public \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
name: Run tests against trunk after PR merge
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
api:
|
||||
name: Run API tests
|
||||
runs-on: ubuntu-20.04
|
||||
if: (github.event.pull_request.merged == true) && (github.event.pull_request.base.ref == 'trunk')
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-report
|
||||
ARTIFACT_NAME: api-pr-merge-${{ github.event.pull_request.number }}-run-${{ github.run_number }}
|
||||
steps:
|
||||
- name: Checkout merge commit on trunk
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.merge_commit_sha }}
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
build-filters: woocommerce
|
||||
|
||||
- name: Setup local test environment
|
||||
uses: ./.github/actions/tests/setup-local-test-environment
|
||||
with:
|
||||
test-type: api
|
||||
|
||||
- name: Run API tests
|
||||
id: run-api-composite-action
|
||||
uses: ./.github/actions/tests/run-api-tests
|
||||
with:
|
||||
report-name: ${{ env.ARTIFACT_NAME }}
|
||||
|
||||
- name: Upload Allure files to bucket
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.ARTIFACT_NAME }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish Allure report
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
run: |
|
||||
gh workflow run publish-test-reports-trunk-merge.yml \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f artifact=${{ env.ARTIFACT_NAME }} \
|
||||
-f pr_number=${{ github.event.pull_request.number }} \
|
||||
-f test_type="api" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Send Slack alert on test failure
|
||||
if: failure() && steps.run-api-composite-action.conclusion == 'failure'
|
||||
uses: ./.github/actions/tests/slack-alert-on-pr-merge
|
||||
with:
|
||||
slack-bot-token: ${{ secrets.E2E_SLACK_TOKEN }}
|
||||
channel-id: ${{ secrets.E2E_TRUNK_SLACK_CHANNEL }}
|
||||
test-type: API
|
||||
|
||||
e2e:
|
||||
name: Run E2E tests
|
||||
needs: [api]
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
|
||||
ARTIFACT_NAME: e2e-pr-merge-${{ github.event.pull_request.number }}-run-${{ github.run_number }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.merge_commit_sha }}
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
build-filters: woocommerce
|
||||
|
||||
- name: Setup local test environment
|
||||
uses: ./.github/actions/tests/setup-local-test-environment
|
||||
with:
|
||||
test-type: e2e
|
||||
|
||||
- name: Run E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 60
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
env:
|
||||
E2E_MAX_FAILURES: 15
|
||||
with:
|
||||
report-name: ${{ env.ARTIFACT_NAME }}
|
||||
|
||||
- name: Upload Allure files to bucket
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.ARTIFACT_NAME }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
include-allure-results: false
|
||||
|
||||
- name: Publish Allure report
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
run: |
|
||||
gh workflow run publish-test-reports-trunk-merge.yml \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f artifact=${{ env.ARTIFACT_NAME }} \
|
||||
-f pr_number=${{ github.event.pull_request.number }} \
|
||||
-f test_type="e2e" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Send Slack alert on test failure
|
||||
if: failure() && steps.run-e2e-composite-action.conclusion == 'failure'
|
||||
uses: ./.github/actions/tests/slack-alert-on-pr-merge
|
||||
with:
|
||||
slack-bot-token: ${{ secrets.E2E_SLACK_TOKEN }}
|
||||
channel-id: ${{ secrets.E2E_TRUNK_SLACK_CHANNEL }}
|
||||
test-type: E2E
|
||||
|
||||
k6:
|
||||
name: Run k6 Performance tests
|
||||
needs: [api]
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.merge_commit_sha }}
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
|
||||
- name: Setup local test environment
|
||||
uses: ./.github/actions/tests/setup-local-test-environment
|
||||
with:
|
||||
test-type: k6
|
||||
|
||||
- name: Run k6 performance tests
|
||||
id: run-k6-composite-action
|
||||
uses: './.github/actions/tests/run-k6-tests'
|
||||
|
||||
- name: Send Slack alert on test failure
|
||||
if: failure() && steps.run-k6-composite-action.conclusion == 'failure'
|
||||
uses: ./.github/actions/tests/slack-alert-on-pr-merge
|
||||
with:
|
||||
slack-bot-token: ${{ secrets.E2E_SLACK_TOKEN }}
|
||||
channel-id: ${{ secrets.E2E_TRUNK_SLACK_CHANNEL }}
|
||||
test-type: k6
|
|
@ -1,21 +1,20 @@
|
|||
name: Smoke test release
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
types: [released, prereleased, published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'WooCommerce Release Tag'
|
||||
required: true
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
group: ${{ github.workflow }}-${{ github.event.release.tag_name || inputs.tag }}
|
||||
cancel-in-progress: true
|
||||
permissions: {}
|
||||
env:
|
||||
E2E_WP_LATEST_ARTIFACT: e2e-wp-latest--run-${{ github.run_number }}
|
||||
E2E_UPDATE_WC_ARTIFACT: e2e-update-wc--run-${{ github.run_number }}
|
||||
FORCE_COLOR: 1
|
||||
|
||||
E2E_WP_LATEST_ARTIFACT: E2E test on release smoke test site with WP Latest (run ${{ github.run_number }})
|
||||
E2E_UPDATE_WC_ARTIFACT: WooCommerce version update test on release smoke test site (run ${{ github.run_number }})
|
||||
SLACK_BLOCKS_ARTIFACT: slack-blocks
|
||||
jobs:
|
||||
get-tag:
|
||||
name: Get WooCommerce release tag
|
||||
|
@ -23,31 +22,31 @@ jobs:
|
|||
contents: read
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
tag: ${{ steps.tag.outputs.result }}
|
||||
tag: ${{ steps.get-tag.outputs.tag }}
|
||||
created: ${{ steps.created-at.outputs.created }}
|
||||
steps:
|
||||
- name: Validate tag
|
||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: gh release view "${{ github.event.inputs.tag }}" --repo=woocommerce/woocommerce
|
||||
GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
run: gh release view "${{ inputs.tag }}" --repo=woocommerce/woocommerce
|
||||
|
||||
- name: Get tag
|
||||
uses: actions/github-script@v6
|
||||
id: tag
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
console.log( "${{ github.event_name }}" );
|
||||
return "${{ github.event.release.tag_name }}" || "${{ github.event.inputs.tag }}"
|
||||
- name: Get tag from triggered event
|
||||
id: get-tag
|
||||
env:
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }}
|
||||
run: |
|
||||
echo "Triggered event: ${{ github.event_name }}"
|
||||
echo "Tag from event: $RELEASE_TAG"
|
||||
echo "tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Verify woocommerce.zip asset
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
RELEASE_TAG: ${{ steps.tag.outputs.result }}
|
||||
GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
RELEASE_TAG: ${{ steps.get-tag.outputs.tag }}
|
||||
run: |
|
||||
gh release download $RELEASE_TAG --repo woocommerce/woocommerce
|
||||
if [[ -f "woocommerce.zip" ]]
|
||||
ASSET_NAMES=$(gh release view $RELEASE_TAG --repo woocommerce/woocommerce --json assets --jq ".assets[].name")
|
||||
if [[ $ASSET_NAMES == *"woocommerce.zip"* ]]
|
||||
then
|
||||
echo "$RELEASE_TAG has a valid woocommerce.zip asset."
|
||||
exit 0
|
||||
|
@ -59,8 +58,8 @@ jobs:
|
|||
- name: Get 'created-at' of WooCommerce zip
|
||||
id: created-at
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: echo "created=$(gh release view ${{ steps.tag.outputs.result }} --json assets --jq .assets[0].createdAt --repo woocommerce/woocommerce)" >> $GITHUB_OUTPUT
|
||||
GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
run: echo "created=$(gh release view ${{ steps.get-tag.outputs.tag }} --json assets --jq .assets[0].createdAt --repo woocommerce/woocommerce)" >> $GITHUB_OUTPUT
|
||||
|
||||
e2e-update-wc:
|
||||
name: Test WooCommerce update
|
||||
|
@ -80,12 +79,13 @@ jobs:
|
|||
install-filters: woocommerce
|
||||
build: false
|
||||
|
||||
- name: Download and install Chromium browser.
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Run 'Update WooCommerce' test.
|
||||
working-directory: plugins/woocommerce
|
||||
- name: Run E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 60
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
with:
|
||||
report-name: ${{ env.E2E_UPDATE_WC_ARTIFACT }}
|
||||
tests: update-woocommerce.spec.js
|
||||
env:
|
||||
ADMIN_PASSWORD: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
||||
ADMIN_USER: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
||||
|
@ -93,37 +93,21 @@ jobs:
|
|||
CUSTOMER_PASSWORD: ${{ secrets.RELEASE_TEST_CUSTOMER_PASSWORD }}
|
||||
CUSTOMER_USER: ${{ secrets.RELEASE_TEST_CUSTOMER_USER }}
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
UPDATE_WC: ${{ needs.get-tag.outputs.tag }}
|
||||
run: |
|
||||
pnpm exec playwright test \
|
||||
--config=tests/e2e-pw/playwright.config.js \
|
||||
update-woocommerce.spec.js
|
||||
|
||||
- name: Generate 'Update WooCommerce' test report.
|
||||
if: success() || failure()
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Configure AWS credentials
|
||||
if: success() || failure()
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
with:
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
- name: Upload Allure files to bucket
|
||||
if: success() || failure()
|
||||
run: |
|
||||
aws s3 sync ${{ env.ALLURE_RESULTS_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.E2E_WP_LATEST_ARTIFACT }}/allure-results \
|
||||
--quiet
|
||||
aws s3 sync ${{ env.ALLURE_REPORT_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.E2E_WP_LATEST_ARTIFACT }}/allure-report \
|
||||
--quiet
|
||||
artifact-name: ${{ env.E2E_WP_LATEST_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish E2E Allure report
|
||||
if: success() || failure()
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: wp-latest
|
||||
|
@ -138,16 +122,17 @@ jobs:
|
|||
-f test_type="e2e" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Archive 'Update WooCommerce' test report
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
- name: Create Slack block
|
||||
if: |
|
||||
success() || (
|
||||
failure() && steps.run-e2e-composite-action.outputs.result == 'failure'
|
||||
)
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-blocks
|
||||
with:
|
||||
name: ${{ env.E2E_UPDATE_WC_ARTIFACT }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
test-name: WC Update test
|
||||
e2e-result: ${{ steps.run-e2e-composite-action.outputs.result }}
|
||||
env-slug: wp-latest
|
||||
release-version: ${{ needs.get-tag.outputs.tag }}
|
||||
|
||||
api-wp-latest:
|
||||
name: API on WP Latest
|
||||
|
@ -155,10 +140,12 @@ jobs:
|
|||
needs: [get-tag, e2e-update-wc]
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
result: ${{ steps.run-api-composite-action.outputs.result }}
|
||||
env:
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/api-test-report/allure-report
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/api-test-report/allure-results
|
||||
API_WP_LATEST_ARTIFACT: api-wp-latest--run-${{ github.run_number }}
|
||||
API_WP_LATEST_ARTIFACT: API test on release smoke test site with WP Latest (run ${{ github.run_number }})
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
|
@ -168,41 +155,29 @@ jobs:
|
|||
install-filters: woocommerce
|
||||
build: false
|
||||
|
||||
- name: Run API tests.
|
||||
working-directory: plugins/woocommerce
|
||||
- name: Run API tests
|
||||
id: run-api-composite-action
|
||||
uses: ./.github/actions/tests/run-api-tests
|
||||
with:
|
||||
report-name: ${{ env.API_WP_LATEST_ARTIFACT }}
|
||||
tests: hello
|
||||
env:
|
||||
BASE_URL: ${{ secrets.RELEASE_TEST_URL }}
|
||||
API_BASE_URL: ${{ secrets.RELEASE_TEST_URL }}
|
||||
USER_KEY: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
||||
USER_SECRET: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
||||
run: pnpm exec playwright test --config=tests/api-core-tests/playwright.config.js hello
|
||||
|
||||
- name: Generate API Test report.
|
||||
if: success() || failure()
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Configure AWS credentials
|
||||
if: success() || failure()
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
with:
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
- name: Upload Allure files to bucket
|
||||
if: success() || failure()
|
||||
run: |
|
||||
aws s3 cp ${{ env.ALLURE_RESULTS_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.API_WP_LATEST_ARTIFACT }}/allure-results \
|
||||
--recursive \
|
||||
--quiet
|
||||
aws s3 cp ${{ env.ALLURE_REPORT_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.API_WP_LATEST_ARTIFACT }}/allure-report \
|
||||
--recursive \
|
||||
--quiet
|
||||
artifact-name: ${{ env.API_WP_LATEST_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish API Allure report
|
||||
if: success() || failure()
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: wp-latest
|
||||
|
@ -217,16 +192,17 @@ jobs:
|
|||
-f test_type="api" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Archive API test report
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
- name: Create Slack block
|
||||
if: |
|
||||
success() || (
|
||||
failure() && steps.run-api-composite-action.outputs.result == 'failure'
|
||||
)
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-blocks
|
||||
with:
|
||||
name: ${{ env.API_WP_LATEST_ARTIFACT }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
test-name: WP Latest
|
||||
api-result: ${{ steps.run-api-composite-action.outputs.result }}
|
||||
env-slug: wp-latest
|
||||
release-version: ${{ needs.get-tag.outputs.tag }}
|
||||
|
||||
e2e-wp-latest:
|
||||
name: E2E on WP Latest
|
||||
|
@ -246,11 +222,13 @@ jobs:
|
|||
install-filters: woocommerce
|
||||
build: false
|
||||
|
||||
- name: Download and install Chromium browser.
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Run E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 60
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
with:
|
||||
report-name: e2e-wp-latest--partial--run-${{ github.run_number }}
|
||||
playwright-config: ignore-plugin-tests.playwright.config.js
|
||||
env:
|
||||
ADMIN_PASSWORD: ${{ secrets.RELEASE_TEST_ADMIN_PASSWORD }}
|
||||
ADMIN_USER: ${{ secrets.RELEASE_TEST_ADMIN_USER }}
|
||||
|
@ -261,9 +239,6 @@ jobs:
|
|||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
E2E_MAX_FAILURES: 25
|
||||
RESET_SITE: true
|
||||
timeout-minutes: 60
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright test --config=tests/e2e-pw/ignore-plugin-tests.playwright.config.js
|
||||
|
||||
- name: Download 'e2e-update-wc' artifact
|
||||
if: success() || failure()
|
||||
|
@ -282,23 +257,26 @@ jobs:
|
|||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Configure AWS credentials
|
||||
- name: Archive E2E test report
|
||||
if: success() || failure()
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
name: ${{ env.E2E_WP_LATEST_ARTIFACT }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
|
||||
- name: Upload report to bucket
|
||||
if: success() || failure()
|
||||
run: |
|
||||
aws s3 sync ${{ env.ALLURE_RESULTS_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.E2E_WP_LATEST_ARTIFACT }}/allure-results \
|
||||
--quiet
|
||||
aws s3 sync ${{ env.ALLURE_REPORT_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.E2E_WP_LATEST_ARTIFACT }}/allure-report \
|
||||
--quiet
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.E2E_WP_LATEST_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish E2E Allure report
|
||||
if: success() || failure()
|
||||
|
@ -316,242 +294,182 @@ jobs:
|
|||
-f test_type="e2e" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Archive E2E test report
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
- name: Create Slack block
|
||||
if: |
|
||||
success() || (
|
||||
failure() && steps.run-e2e-composite-action.outputs.result == 'failure'
|
||||
)
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-blocks
|
||||
with:
|
||||
name: ${{ env.E2E_WP_LATEST_ARTIFACT }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
test-name: WP Latest
|
||||
api-result: ${{ needs.api-wp-latest.outputs.result }}
|
||||
e2e-result: ${{ steps.run-e2e-composite-action.outputs.result }}
|
||||
env-slug: wp-latest
|
||||
release-version: ${{ needs.get-tag.outputs.tag }}
|
||||
|
||||
get-wp-versions:
|
||||
name: Get WP L-1 & L-2 version numbers
|
||||
needs: [get-tag]
|
||||
test-wp-latest-1:
|
||||
name: Test against WP Latest-1
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
matrix: ${{ steps.get-versions.outputs.versions }}
|
||||
tag: ${{ needs.get-tag.outputs.tag }}
|
||||
created: ${{ needs.get-tag.outputs.created }}
|
||||
steps:
|
||||
- name: Create dirs
|
||||
run: |
|
||||
mkdir script
|
||||
mkdir repo
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: repo
|
||||
|
||||
- name: Copy script to get previous WP versions
|
||||
run: cp repo/plugins/woocommerce/tests/e2e-pw/utils/wordpress.js script
|
||||
|
||||
- name: Install axios
|
||||
working-directory: script
|
||||
run: npm install axios
|
||||
|
||||
- name: Get version numbers
|
||||
id: get-versions
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const { getPreviousTwoVersions } = require('./script/wordpress');
|
||||
const versions = await getPreviousTwoVersions();
|
||||
console.log(versions);
|
||||
core.setOutput('versions', versions);
|
||||
|
||||
test-wp-versions:
|
||||
name: Test against ${{ matrix.version.description }} (${{ matrix.version.number }})
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [get-wp-versions]
|
||||
strategy:
|
||||
matrix: ${{ fromJSON(needs.get-wp-versions.outputs.matrix) }}
|
||||
needs: [ get-tag ]
|
||||
env:
|
||||
API_ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/api/allure-report
|
||||
API_ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/api/allure-results
|
||||
API_WP_LATEST_X_ARTIFACT: api-${{ matrix.version.env_description }}--run-${{ github.run_number }}
|
||||
API_WP_LATEST_X_ARTIFACT: API test on wp-env with WordPress L-1 (run ${{ github.run_number }})
|
||||
E2E_ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/e2e/allure-report
|
||||
E2E_ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/e2e/allure-results
|
||||
E2E_WP_LATEST_X_ARTIFACT: e2e-${{ matrix.version.env_description }}--run-${{ github.run_number }}
|
||||
E2E_WP_LATEST_X_ARTIFACT: E2E test on wp-env with WordPress L-1 (run ${{ github.run_number }})
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout WooCommerce repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get WP Latest-1 version number
|
||||
id: get-wp-latest-1
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const { getVersionWPLatestMinusOne } = require( './plugins/woocommerce/tests/e2e-pw/utils/wordpress' );
|
||||
await getVersionWPLatestMinusOne( { core, github } );
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
build-filters: woocommerce
|
||||
|
||||
- name: Launch WP Env
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm run env:test
|
||||
env:
|
||||
WP_ENV_CORE: WordPress/WordPress#${{ steps.get-wp-latest-1.outputs.version }}
|
||||
|
||||
- name: Download release zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
run: gh release download ${{ needs.get-wp-versions.outputs.tag }} --dir tmp
|
||||
GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
run: gh release download ${{ steps.get-wp-latest-1.outputs.version }} --dir tmp
|
||||
|
||||
- name: Replace `plugins/woocommerce` with unzipped woocommerce release build
|
||||
run: unzip -d plugins -o tmp/woocommerce.zip
|
||||
|
||||
- name: Downgrade WordPress version to ${{ matrix.version.number }}
|
||||
working-directory: plugins/woocommerce
|
||||
run: |
|
||||
pnpm exec wp-env run tests-cli "wp core update --version=${{ matrix.version.number }} --force"
|
||||
pnpm exec wp-env run tests-cli "wp core update-db"
|
||||
|
||||
- name: Verify environment details
|
||||
working-directory: plugins/woocommerce
|
||||
run: |
|
||||
pnpm exec wp-env run tests-cli "wp core version"
|
||||
pnpm exec wp-env run tests-cli "wp plugin list"
|
||||
pnpm exec wp-env run tests-cli "wp theme list"
|
||||
pnpm exec wp-env run tests-cli "wp user list"
|
||||
|
||||
- name: Run API tests.
|
||||
id: api
|
||||
working-directory: plugins/woocommerce
|
||||
- name: Run API tests
|
||||
id: run-api-composite-action
|
||||
uses: ./.github/actions/tests/run-api-tests
|
||||
with:
|
||||
report-name: ${{ env.API_WP_LATEST_X_ARTIFACT }}
|
||||
tests: hello.test.js
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.API_ALLURE_RESULTS_DIR }}
|
||||
run: pnpm exec playwright test --config=tests/api-core-tests/playwright.config.js hello
|
||||
ALLURE_REPORT_DIR: ${{ env.API_ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Generate API Allure report.
|
||||
if: success() || failure()
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.API_ALLURE_RESULTS_DIR }} --output ${{ env.API_ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Configure AWS credentials
|
||||
if: success() || failure()
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.API_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.API_ALLURE_REPORT_DIR }}
|
||||
with:
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
- name: Upload API Allure artifacts to bucket
|
||||
if: success() || failure()
|
||||
run: |
|
||||
aws s3 sync ${{ env.API_ALLURE_RESULTS_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.API_WP_LATEST_X_ARTIFACT }}/allure-results \
|
||||
--quiet
|
||||
aws s3 sync ${{ env.API_ALLURE_REPORT_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.API_WP_LATEST_X_ARTIFACT }}/allure-report \
|
||||
--quiet
|
||||
artifact-name: ${{ env.API_WP_LATEST_X_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish API Allure report
|
||||
if: success() || failure()
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: ${{ matrix.version.env_description }}
|
||||
ENV_DESCRIPTION: wp-latest-1
|
||||
run: |
|
||||
gh workflow run publish-test-reports-release.yml \
|
||||
-f created_at="${{ needs.get-wp-versions.outputs.created }}" \
|
||||
-f created_at="${{ needs.get-tag.outputs.created }}" \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f run_number=${{ github.run_number }} \
|
||||
-f release_tag=${{ needs.get-wp-versions.outputs.tag }} \
|
||||
-f release_tag=${{ needs.get-tag.outputs.tag }} \
|
||||
-f artifact="${{ env.API_WP_LATEST_X_ARTIFACT }}" \
|
||||
-f env_description="${{ env.ENV_DESCRIPTION }}" \
|
||||
-f test_type="api" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Archive API Allure reports
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.API_WP_LATEST_X_ARTIFACT }}
|
||||
path: |
|
||||
${{ env.API_ALLURE_RESULTS_DIR }}
|
||||
${{ env.API_ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
|
||||
- name: Download and install Chromium browser.
|
||||
if: success() || failure()
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Run E2E tests.
|
||||
if: |
|
||||
success() ||
|
||||
( failure() && steps.api.conclusion == 'success' )
|
||||
- name: Run E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 60
|
||||
id: e2e
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
env:
|
||||
USE_WP_ENV: 1
|
||||
E2E_MAX_FAILURES: 15
|
||||
FORCE_COLOR: 1
|
||||
ALLURE_RESULTS_DIR: ${{ env.E2E_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.E2E_ALLURE_REPORT_DIR }}
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js
|
||||
|
||||
- name: Generate E2E Allure report.
|
||||
if: success() || failure()
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.E2E_ALLURE_RESULTS_DIR }} --output ${{ env.E2E_ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Upload E2E Allure artifacts to bucket
|
||||
if: success() || failure()
|
||||
run: |
|
||||
aws s3 sync ${{ env.E2E_ALLURE_RESULTS_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.E2E_WP_LATEST_X_ARTIFACT }}/allure-results \
|
||||
--quiet
|
||||
aws s3 sync ${{ env.E2E_ALLURE_REPORT_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.E2E_WP_LATEST_X_ARTIFACT }}/allure-report \
|
||||
--quiet
|
||||
|
||||
- name: Archive E2E Allure reports
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.E2E_WP_LATEST_X_ARTIFACT }}
|
||||
path: |
|
||||
${{ env.E2E_ALLURE_RESULTS_DIR }}
|
||||
${{ env.E2E_ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
report-name: ${{ env.E2E_WP_LATEST_X_ARTIFACT }}
|
||||
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.E2E_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.E2E_ALLURE_REPORT_DIR }}
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.E2E_WP_LATEST_X_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish E2E Allure report
|
||||
if: success() || failure()
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: ${{ matrix.version.env_description }}
|
||||
ENV_DESCRIPTION: wp-latest-1
|
||||
run: |
|
||||
gh workflow run publish-test-reports-release.yml \
|
||||
-f created_at="${{ needs.get-wp-versions.outputs.created }}" \
|
||||
-f created_at="${{ needs.get-tag.outputs.created }}" \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f run_number=${{ github.run_number }} \
|
||||
-f release_tag=${{ needs.get-wp-versions.outputs.tag }} \
|
||||
-f release_tag=${{ needs.get-tag.outputs.tag }} \
|
||||
-f artifact="${{ env.E2E_WP_LATEST_X_ARTIFACT }}" \
|
||||
-f env_description="${{ env.ENV_DESCRIPTION }}" \
|
||||
-f test_type="e2e" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Create Slack block
|
||||
if: |
|
||||
success() || (
|
||||
failure() && (
|
||||
steps.run-api-composite-action.outputs.result == 'failure' ||
|
||||
steps.run-e2e-composite-action.outputs.result == 'failure'
|
||||
)
|
||||
)
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-blocks
|
||||
with:
|
||||
test-name: WP Latest-1 (${{ steps.get-wp-latest-1.outputs.version }})
|
||||
api-result: ${{ steps.run-api-composite-action.outputs.result }}
|
||||
e2e-result: ${{ steps.run-e2e-composite-action.outputs.result }}
|
||||
env-slug: wp-latest-1
|
||||
release-version: ${{ needs.get-tag.outputs.tag }}
|
||||
|
||||
test-php-versions:
|
||||
name: Test against PHP ${{ matrix.php_version }}
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [get-tag]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php_version: ['7.4', '8.1']
|
||||
env:
|
||||
API_ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-report
|
||||
API_ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-results
|
||||
API_ARTIFACT: api-php-${{ matrix.php_version }}--run-${{ github.run_number }}
|
||||
API_ARTIFACT: API test on wp-env with PHP ${{ matrix.php_version }} (run ${{ github.run_number }})
|
||||
E2E_ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
|
||||
E2E_ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
|
||||
E2E_ARTIFACT: e2e-php-${{ matrix.php_version }}--run-${{ github.run_number }}
|
||||
E2E_ARTIFACT: E2E test on wp-env with PHP ${{ matrix.php_version }} (run ${{ github.run_number }})
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
build-filters: woocommerce
|
||||
|
||||
- name: Launch WP Env
|
||||
working-directory: plugins/woocommerce
|
||||
|
@ -567,44 +485,37 @@ jobs:
|
|||
|
||||
- name: Download release zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
run: gh release download ${{ needs.get-tag.outputs.tag }} --dir tmp
|
||||
|
||||
- name: Replace `plugins/woocommerce` with unzipped woocommerce release build
|
||||
run: unzip -d plugins -o tmp/woocommerce.zip
|
||||
|
||||
- name: Run API tests.
|
||||
id: api
|
||||
working-directory: plugins/woocommerce
|
||||
- name: Run API tests
|
||||
id: run-api-composite-action
|
||||
uses: ./.github/actions/tests/run-api-tests
|
||||
with:
|
||||
report-name: ${{ env.API_ARTIFACT }}
|
||||
tests: hello.test.js
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.API_ALLURE_RESULTS_DIR }}
|
||||
run: pnpm exec playwright test --config=tests/api-core-tests/playwright.config.js hello
|
||||
ALLURE_REPORT_DIR: ${{ env.API_ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Generate API Allure report.
|
||||
if: success() || failure()
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.API_ALLURE_RESULTS_DIR }} --output ${{ env.API_ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Configure AWS credentials
|
||||
if: success() || failure()
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.API_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.API_ALLURE_REPORT_DIR }}
|
||||
with:
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
- name: Upload API Allure artifacts to bucket
|
||||
if: success() || failure()
|
||||
run: |
|
||||
aws s3 sync ${{ env.API_ALLURE_RESULTS_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.API_ARTIFACT }}/allure-results \
|
||||
--quiet
|
||||
aws s3 sync ${{ env.API_ALLURE_REPORT_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.API_ARTIFACT }}/allure-report \
|
||||
--quiet
|
||||
artifact-name: ${{ env.API_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish API Allure report
|
||||
if: success() || failure()
|
||||
if: success() || ( failure() && steps.run-api-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: php-${{ matrix.php_version }}
|
||||
|
@ -619,63 +530,33 @@ jobs:
|
|||
-f test_type="api" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Archive API Allure reports
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.API_ARTIFACT }}
|
||||
path: |
|
||||
${{ env.API_ALLURE_RESULTS_DIR }}
|
||||
${{ env.API_ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
|
||||
- name: Download and install Chromium browser.
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright install chromium
|
||||
|
||||
- name: Run E2E tests.
|
||||
if: |
|
||||
success() ||
|
||||
( failure() && steps.api.conclusion == 'success' )
|
||||
- name: Run E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 60
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
env:
|
||||
USE_WP_ENV: 1
|
||||
E2E_MAX_FAILURES: 15
|
||||
FORCE_COLOR: 1
|
||||
ALLURE_RESULTS_DIR: ${{ env.E2E_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.E2E_ALLURE_REPORT_DIR }}
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js
|
||||
|
||||
- name: Generate E2E Allure report.
|
||||
if: success() || failure()
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.E2E_ALLURE_RESULTS_DIR }} --output ${{ env.E2E_ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Upload E2E Allure artifacts to bucket
|
||||
if: success() || failure()
|
||||
run: |
|
||||
aws s3 sync ${{ env.E2E_ALLURE_RESULTS_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.E2E_ARTIFACT }}/allure-results \
|
||||
--quiet
|
||||
aws s3 sync ${{ env.E2E_ALLURE_REPORT_DIR }} \
|
||||
${{ secrets.REPORTS_BUCKET }}/artifacts/${{ github.run_id }}/${{ env.E2E_ARTIFACT }}/allure-report \
|
||||
--quiet
|
||||
|
||||
- name: Archive E2E Allure reports
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
E2E_MAX_FAILURES: 15
|
||||
with:
|
||||
name: ${{ env.E2E_ARTIFACT }}
|
||||
path: |
|
||||
${{ env.E2E_ALLURE_RESULTS_DIR }}
|
||||
${{ env.E2E_ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 5
|
||||
report-name: ${{ env.E2E_ARTIFACT }}
|
||||
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ env.E2E_ALLURE_RESULTS_DIR }}
|
||||
ALLURE_REPORT_DIR: ${{ env.E2E_ALLURE_REPORT_DIR }}
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.E2E_ARTIFACT }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish E2E Allure report
|
||||
if: success() || failure()
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
ENV_DESCRIPTION: php-${{ matrix.php_version }}
|
||||
|
@ -689,3 +570,172 @@ jobs:
|
|||
-f env_description="${{ env.ENV_DESCRIPTION }}" \
|
||||
-f test_type="e2e" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Create Slack block
|
||||
if: |
|
||||
success() || (
|
||||
failure() && (
|
||||
steps.run-api-composite-action.outputs.result == 'failure' ||
|
||||
steps.run-e2e-composite-action.outputs.result == 'failure'
|
||||
)
|
||||
)
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-blocks
|
||||
with:
|
||||
test-name: PHP ${{ matrix.php_version }}
|
||||
api-result: ${{ steps.run-api-composite-action.outputs.result }}
|
||||
e2e-result: ${{ steps.run-e2e-composite-action.outputs.result }}
|
||||
env-slug: php-${{ matrix.php_version }}
|
||||
release-version: ${{ needs.get-tag.outputs.tag }}
|
||||
|
||||
test-plugins:
|
||||
name: With ${{ matrix.plugin }}
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [get-tag]
|
||||
env:
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-results
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-report
|
||||
ARTIFACT_NAME: E2E test on wp-env with ${{ matrix.plugin }} installed (run ${{ github.run_number }})
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- plugin: 'WooCommerce Payments'
|
||||
repo: 'automattic/woocommerce-payments'
|
||||
env_description: 'woocommerce-payments'
|
||||
- plugin: 'WooCommerce PayPal Payments'
|
||||
repo: 'woocommerce/woocommerce-paypal-payments'
|
||||
env_description: 'woocommerce-paypal-payments'
|
||||
- plugin: 'WooCommerce Shipping & Tax'
|
||||
repo: 'automattic/woocommerce-services'
|
||||
env_description: 'woocommerce-shipping-&-tax'
|
||||
- plugin: 'WooCommerce Subscriptions'
|
||||
repo: WC_SUBSCRIPTIONS_REPO
|
||||
private: true
|
||||
env_description: 'woocommerce-subscriptions'
|
||||
- plugin: 'Gutenberg'
|
||||
repo: 'WordPress/gutenberg'
|
||||
env_description: 'gutenberg'
|
||||
- plugin: 'Gutenberg - Nightly'
|
||||
repo: 'bph/gutenberg'
|
||||
env_description: 'gutenberg-nightly'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
with:
|
||||
build-filters: woocommerce
|
||||
|
||||
- name: Launch WP Env
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm run env:test
|
||||
|
||||
- name: Download release zip
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
run: gh release download ${{ needs.get-tag.outputs.tag }} --dir tmp
|
||||
|
||||
- name: Replace `plugins/woocommerce` with unzipped woocommerce release build
|
||||
run: unzip -d plugins -o tmp/woocommerce.zip
|
||||
|
||||
- name: Run 'Upload plugin' test
|
||||
id: run-upload-test
|
||||
timeout-minutes: 60
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
with:
|
||||
report-name: ${{ env.ARTIFACT_NAME }}
|
||||
tests: upload-plugin.spec.js
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
PLUGIN_NAME: ${{ matrix.plugin }}
|
||||
PLUGIN_REPOSITORY: ${{ matrix.private && secrets[matrix.repo] || matrix.repo }}
|
||||
|
||||
- name: Run the rest of E2E tests
|
||||
id: run-e2e-composite-action
|
||||
timeout-minutes: 60
|
||||
uses: ./.github/actions/tests/run-e2e-tests
|
||||
with:
|
||||
playwright-config: ignore-plugin-tests.playwright.config.js
|
||||
report-name: ${{ env.ARTIFACT_NAME }}
|
||||
env:
|
||||
E2E_MAX_FAILURES: 15
|
||||
|
||||
- name: Upload Allure artifacts to bucket
|
||||
if: |
|
||||
success() ||
|
||||
( failure() &&
|
||||
( steps.run-upload-test.conclusion == 'failure' || steps.run-e2e-composite-action.conclusion == 'failure' ) )
|
||||
uses: ./.github/actions/tests/upload-allure-files-to-bucket
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
|
||||
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
|
||||
aws-secret-access-key: ${{ secrets.REPORTS_AWS_SECRET_ACCESS_KEY }}
|
||||
artifact-name: ${{ env.ARTIFACT_NAME }}
|
||||
s3-bucket: ${{ secrets.REPORTS_BUCKET }}
|
||||
|
||||
- name: Publish E2E Allure report
|
||||
if: success() || ( failure() && steps.run-e2e-composite-action.conclusion == 'failure' )
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||
run: |
|
||||
gh workflow run publish-test-reports-release.yml \
|
||||
-f created_at="${{ needs.get-tag.outputs.created }}" \
|
||||
-f run_id=${{ github.run_id }} \
|
||||
-f run_number=${{ github.run_number }} \
|
||||
-f release_tag=${{ needs.get-tag.outputs.tag }} \
|
||||
-f artifact="${{ env.ARTIFACT_NAME }}" \
|
||||
-f env_description="${{ matrix.env_description }}" \
|
||||
-f test_type="e2e" \
|
||||
--repo woocommerce/woocommerce-test-reports
|
||||
|
||||
- name: Create Slack block
|
||||
if: |
|
||||
success() || (
|
||||
failure() && steps.run-e2e-composite-action.outputs.result == 'failure' )
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-blocks
|
||||
with:
|
||||
test-name: With ${{ matrix.plugin }}
|
||||
e2e-result: ${{ steps.run-e2e-composite-action.outputs.result }}
|
||||
env-slug: ${{ matrix.env_description }}
|
||||
release-version: ${{ needs.get-tag.outputs.tag }}
|
||||
|
||||
post-slack-summary:
|
||||
name: Post Slack summary
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
contents: read
|
||||
if: |
|
||||
success() || (
|
||||
failure() && contains( needs.*.result, 'failure' )
|
||||
)
|
||||
needs:
|
||||
- e2e-wp-latest
|
||||
- get-tag
|
||||
- test-php-versions
|
||||
- test-plugins
|
||||
- test-wp-latest-1
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Download all slack blocks
|
||||
id: download-slack-blocks
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.SLACK_BLOCKS_ARTIFACT }}
|
||||
path: /tmp/slack-payload
|
||||
|
||||
- name: Construct payload from all blocks
|
||||
id: run-payload-action
|
||||
uses: ./.github/actions/tests/slack-summary-on-release/slack-payload
|
||||
with:
|
||||
release-version: ${{ needs.get-tag.outputs.tag }}
|
||||
blocks-dir: ${{ steps.download-slack-blocks.outputs.download-path }}
|
||||
|
||||
- name: Send Slack message
|
||||
uses: slackapi/slack-github-action@v1.23.0
|
||||
with:
|
||||
channel-id: ${{ secrets.RELEASE_TEST_SLACK_CHANNEL }}
|
||||
payload: ${{ steps.run-payload-action.outputs.payload }}
|
||||
env:
|
||||
SLACK_BOT_TOKEN: ${{ secrets.E2E_SLACK_TOKEN }}
|
||||
|
|
|
@ -25,7 +25,7 @@ jobs:
|
|||
node-version: 16
|
||||
|
||||
- name: 'Install Syncpack'
|
||||
run: npm install -g syncpack@^8.2.4
|
||||
run: npm install -g syncpack@^9.8.4
|
||||
|
||||
- name: 'List Mismatches'
|
||||
run: syncpack list-mismatches
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
name: Send a Slack notification when PR is merged
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [closed]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
send-slack-notification-when-pr-merged:
|
||||
if: "${{ github.event.pull_request.merged }}"
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Wait 2 minutes for other labelling jobs to finish
|
||||
run: sleep 2m
|
||||
shell: bash
|
||||
- name: Notify Slack
|
||||
uses: archive/github-actions-slack@d9dae40827adf93bddf939db6552d1e392259d7d
|
||||
id: notify
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.TEST_ASSISTANCE_BOT_TOKEN }}
|
||||
slack-channel: ${{ secrets.WOO_PR_MERGED_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
<${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>
|
||||
*Labels:* ${{ join(github.event.pull_request.labels.*.name, ', ') }}
|
||||
slack-optional-unfurl_links: false
|
||||
slack-optional-unfurl_media: false
|
|
@ -0,0 +1,24 @@
|
|||
name: Send PRs that require further testing to Slack
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [labeled]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
send-pr-to-slack-for-further-testing:
|
||||
if: "${{ github.event.label.name == 'needs: analysis' && (github.event.pull_request.state == 'open' || github.event.pull_request.merged) }}"
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
sparse-checkout: |
|
||||
.github/actions/pr-scrub-notify-slack
|
||||
ref: trunk
|
||||
- name: 'Trigger PR scrub'
|
||||
uses: ./.github/actions/pr-scrub-notify-slack
|
||||
with:
|
||||
TEST_ASSISTANCE_BOT_TOKEN: ${{ secrets.TEST_ASSISTANCE_BOT_TOKEN }}
|
||||
WOO_PR_TESTING_ANALYSIS_SLACK_CHANNEL: ${{ secrets.WOO_PR_TESTING_ANALYSIS_SLACK_CHANNEL }}
|
||||
WOO_PR_TESTING_ANALYSIS_TEAM_ID: ${{ secrets.WOO_PR_TESTING_ANALYSIS_TEAM_ID }}
|
||||
|
|
@ -22,8 +22,9 @@ none
|
|||
# Logs
|
||||
logs/
|
||||
|
||||
# Eslint Cache
|
||||
# Eslint
|
||||
.eslintcache
|
||||
eslint_report.json
|
||||
|
||||
# Environment files
|
||||
wp-cli.local.yml
|
||||
|
@ -40,6 +41,7 @@ npm-debug.log
|
|||
build/
|
||||
build-module/
|
||||
build-style/
|
||||
build-style.js
|
||||
build-types/
|
||||
dist/
|
||||
|
||||
|
@ -81,6 +83,9 @@ plugins/woocommerce/includes/react-admin/feature-config.php
|
|||
# PHP lint
|
||||
phpcs-report.xml
|
||||
|
||||
#PHP Unit
|
||||
.phpunit.result.cache
|
||||
|
||||
# Allure directories
|
||||
allure-report
|
||||
allure-results
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"default": true,
|
||||
"MD003": { "style": "atx" },
|
||||
"MD007": { "indent": 4 },
|
||||
"MD013": { "line_length": 9999 },
|
||||
"no-hard-tabs": false,
|
||||
"whitespace": false
|
||||
}
|
191
.syncpackrc
191
.syncpackrc
|
@ -1,22 +1,39 @@
|
|||
{
|
||||
"dev": true,
|
||||
"filter": "^(?:config|react|react-dom|eslint|typescript|@typescript-eslint|@types/react).*$",
|
||||
"indent": "\t",
|
||||
"overrides": true,
|
||||
"peer": true,
|
||||
"pnpmOverrides": true,
|
||||
"prod": true,
|
||||
"semverRange": "^",
|
||||
"workspace": true,
|
||||
"customTypes": {
|
||||
"engines": {
|
||||
"path": "engines",
|
||||
"strategy": "versionsByName"
|
||||
}
|
||||
},
|
||||
"versionGroups": [
|
||||
{
|
||||
"dependencies": [
|
||||
"pnpm"
|
||||
],
|
||||
"pinVersion": "^8.6.7",
|
||||
"packages": [
|
||||
"**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"node"
|
||||
],
|
||||
"dependencyTypes": [
|
||||
"engines"
|
||||
],
|
||||
"pinVersion": "^16.14.1",
|
||||
"packages": [
|
||||
"**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"@typescript-eslint/**"
|
||||
],
|
||||
"dependencyTypes": [
|
||||
"devDependencies"
|
||||
],
|
||||
"pinVersion": "^5.43.0",
|
||||
"pinVersion": "^5.54.0",
|
||||
"packages": [
|
||||
"**"
|
||||
]
|
||||
|
@ -59,7 +76,7 @@
|
|||
"packages": [
|
||||
"**"
|
||||
],
|
||||
"pinVersion": "^4.8.3"
|
||||
"pinVersion": "^5.1.6"
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
|
@ -72,6 +89,156 @@
|
|||
"**"
|
||||
],
|
||||
"pinVersion": "^8.32.0"
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"@wordpress/babel-plugin-import-jsx-pragma",
|
||||
"@wordpress/babel-preset-default",
|
||||
"@wordpress/stylelint-config",
|
||||
"@wordpress/scripts",
|
||||
"@wordpress/jest-console",
|
||||
"@wordpress/dependency-extraction-webpack-plugin",
|
||||
"@wordpress/e2e-test-utils",
|
||||
"@wordpress/jest-preset-default",
|
||||
"@wordpress/postcss-plugins-preset",
|
||||
"@wordpress/custom-templated-path-webpack-plugin",
|
||||
"@wordpress/postcss-themes"
|
||||
],
|
||||
"packages": [
|
||||
"**"
|
||||
],
|
||||
"isIgnored": true
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"@wordpress/block**",
|
||||
"@wordpress/viewport",
|
||||
"@wordpress/interface",
|
||||
"@wordpress/router",
|
||||
"@wordpress/edit-site"
|
||||
],
|
||||
"packages": [
|
||||
"@woocommerce/product-editor",
|
||||
"woocommerce/client/admin",
|
||||
"@woocommerce/components"
|
||||
],
|
||||
"isIgnored": true
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"@wordpress/**"
|
||||
],
|
||||
"packages": [
|
||||
"@woocommerce/experimental"
|
||||
],
|
||||
"isIgnored": true
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"@wordpress/prettier-config"
|
||||
],
|
||||
"packages": [
|
||||
"**"
|
||||
],
|
||||
"pinVersion": "2.17.0"
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"@wordpress/eslint-plugin"
|
||||
],
|
||||
"packages": [
|
||||
"**"
|
||||
],
|
||||
"pinVersion": "14.7.0"
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"@wordpress/env"
|
||||
],
|
||||
"packages": [
|
||||
"**"
|
||||
],
|
||||
"pinVersion": "^8.2.0"
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"@wordpress/**"
|
||||
],
|
||||
"packages": [
|
||||
"**"
|
||||
],
|
||||
"pinVersion": "wp-6.0"
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"@types/wordpress__components"
|
||||
],
|
||||
"packages": [
|
||||
"**"
|
||||
],
|
||||
"pinVersion": "^19.10.3"
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"postcss-loader"
|
||||
],
|
||||
"dependencyTypes": [
|
||||
"devDependencies"
|
||||
],
|
||||
"packages": [
|
||||
"**"
|
||||
],
|
||||
"pinVersion": "^4.3.0"
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"postcss"
|
||||
],
|
||||
"packages": [
|
||||
"**"
|
||||
],
|
||||
"pinVersion": "^8.4.7"
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
"@types/node"
|
||||
],
|
||||
"packages": [
|
||||
"**"
|
||||
],
|
||||
"pinVersion": "^16.18.18"
|
||||
},
|
||||
{
|
||||
"label": "Only manage versions for these dependencies",
|
||||
"dependencies": [
|
||||
"@types/node",
|
||||
"@types/react",
|
||||
"@types/wordpress__components",
|
||||
"@typescript-eslint/**",
|
||||
"@wordpress/**",
|
||||
"config",
|
||||
"eslint",
|
||||
"node",
|
||||
"pnpm",
|
||||
"postcss",
|
||||
"postcss-loader",
|
||||
"react",
|
||||
"react-dom",
|
||||
"typescript"
|
||||
],
|
||||
"packages": [
|
||||
"**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Ignore versions for everything else",
|
||||
"dependencies": [
|
||||
"**"
|
||||
],
|
||||
"packages": [
|
||||
"**"
|
||||
],
|
||||
"isIgnored": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -23,26 +23,26 @@ Here are some examples of the ways you can use Turborepo / pnpm commands:
|
|||
```bash
|
||||
# Lint and build all plugins, packages, and tools. Note the use of `-r` for lint,
|
||||
# turbo does not run the lint at this time.
|
||||
pnpm run -r lint && pnpm run build
|
||||
pnpm run -r lint && pnpm run build
|
||||
|
||||
# Build WooCommerce Core and all of its dependencies
|
||||
pnpm run --filter='woocommerce' build
|
||||
pnpm run --filter='woocommerce' build
|
||||
|
||||
# Lint the @woocommerce/components package - note the different argument order, turbo scripts
|
||||
# are not running lints at this point in time.
|
||||
pnpm run -r --filter='@woocommerce/components' lint
|
||||
pnpm run -r --filter='@woocommerce/components' lint
|
||||
|
||||
# Test all of the @woocommerce scoped packages
|
||||
pnpm run --filter='@woocommerce/*' test
|
||||
pnpm run --filter='@woocommerce/*' test
|
||||
|
||||
# Build all of the JavaScript packages
|
||||
pnpm run --filter='./packages/js/*' build
|
||||
pnpm run --filter='./packages/js/*' build
|
||||
|
||||
# Build everything except WooCommerce Core
|
||||
pnpm run --filter='!woocommerce' build
|
||||
pnpm run --filter='!woocommerce' build
|
||||
|
||||
# Build everything that has changed since the last commit
|
||||
pnpm run --filter='[HEAD^1]' build
|
||||
pnpm run --filter='[HEAD^1]' build
|
||||
```
|
||||
|
||||
### Cache busting Turbo
|
||||
|
@ -90,3 +90,25 @@ pnpm -- wp-env destroy
|
|||
Each of the [plugins in our repository](plugins) support using this tool to spin up a development environment. Note that rather than having a single top-level environment, each plugin has its own. This is done in order to prevent conflicts between them.
|
||||
|
||||
Please check out [the official documentation](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) if you would like to learn more about this tool.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Installing PHP in Unix (e.g. Ubuntu)
|
||||
|
||||
Many unix systems such as Ubuntu will have PHP already installed. Sometimes without the extra packages you need to run WordPress and this will cause you to run into troubles.
|
||||
|
||||
Use your package manager to add the extra PHP packages you'll need.
|
||||
e.g. in Ubuntu you can run:
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt install php-bcmath \
|
||||
php-curl \
|
||||
php-imagick \
|
||||
php-intl \
|
||||
php-json \
|
||||
php-mbstring \
|
||||
php-mysql \
|
||||
php-xml \
|
||||
php-zip
|
||||
```
|
||||
|
|
34
README.md
34
README.md
|
@ -1,4 +1,6 @@
|
|||
<p align="center"><a href="https://woocommerce.com/"><img src="https://woocommerce.com/wp-content/themes/woo/images/logo-woocommerce@2x.png" alt="WooCommerce"></a></p>
|
||||
# WooCommerce Monorepo
|
||||
|
||||
![WooCommerce](https://woocommerce.com/wp-content/themes/woo/images/logo-woocommerce@2x.png)
|
||||
|
||||
Welcome to the WooCommerce Monorepo on GitHub. Here you can find all of the plugins, packages, and tools used in the development of the core WooCommerce plugin as well as WooCommerce extensions. You can browse the source, look at open issues, contribute code, and keep tracking of ongoing development.
|
||||
|
||||
|
@ -10,10 +12,10 @@ To get up and running within the WooCommerce Monorepo, you will need to make sur
|
|||
|
||||
### Prerequisites
|
||||
|
||||
* [NVM](https://github.com/nvm-sh/nvm#installing-and-updating): While you can always install Node through other means, we recommend using NVM to ensure you're aligned with the version used by our development teams. Our repository contains [an `.nvmrc` file](.nvmrc) which helps ensure you are using the correct version of Node.
|
||||
* [PNPM](https://pnpm.io/installation): Our repository utilizes PNPM to manage project dependencies and run various scripts involved in building and testing projects.
|
||||
* [PHP 7.2+](https://www.php.net/manual/en/install.php): WooCommerce Core currently features a minimum PHP version of 7.2. It is also needed to run Composer and various project build scripts.
|
||||
* [Composer](https://getcomposer.org/doc/00-intro.md): We use Composer to manage all of the dependencies for PHP packages and plugins.
|
||||
- [NVM](https://github.com/nvm-sh/nvm#installing-and-updating): While you can always install Node through other means, we recommend using NVM to ensure you're aligned with the version used by our development teams. Our repository contains [an `.nvmrc` file](.nvmrc) which helps ensure you are using the correct version of Node.
|
||||
- [PNPM](https://pnpm.io/installation): Our repository utilizes PNPM to manage project dependencies and run various scripts involved in building and testing projects.
|
||||
- [PHP 7.4+](https://www.php.net/manual/en/install.php): WooCommerce Core currently features a minimum PHP version of 7.4. It is also needed to run Composer and various project build scripts. See [troubleshooting](DEVELOPMENT.md#troubleshooting) for troubleshooting problems installing PHP.
|
||||
- [Composer](https://getcomposer.org/doc/00-intro.md): We use Composer to manage all of the dependencies for PHP packages and plugins.
|
||||
|
||||
Once you've installed all of the prerequisites, you can run the following commands to get everything working.
|
||||
|
||||
|
@ -32,27 +34,31 @@ Check out [our development guide](DEVELOPMENT.md) if you would like a more compr
|
|||
|
||||
## Repository Structure
|
||||
|
||||
* [**Plugins**](plugins): Our repository contains plugins that relate to or otherwise aid in the development of WooCommerce.
|
||||
* [**WooCommerce Core**](plugins/woocommerce): The core WooCommerce plugin is available in the plugins directory.
|
||||
* [**Packages**](packages): Contained within the packages directory are all of the [PHP](packages/php) and [JavaScript](packages/js) provided for the community. Some of these are internal dependencies and are marked with an `internal-` prefix.
|
||||
* [**Tools**](tools): We also have a growing number of tools within our repository. Many of these are intended to be utilities and scripts for use in the monorepo, but, this directory may also contain external tools.
|
||||
- [**Plugins**](plugins): Our repository contains plugins that relate to or otherwise aid in the development of WooCommerce.
|
||||
- [**WooCommerce Core**](plugins/woocommerce): The core WooCommerce plugin is available in the plugins directory.
|
||||
- [**Packages**](packages): Contained within the packages directory are all of the [PHP](packages/php) and [JavaScript](packages/js) provided for the community. Some of these are internal dependencies and are marked with an `internal-` prefix.
|
||||
- [**Tools**](tools): We also have a growing number of tools within our repository. Many of these are intended to be utilities and scripts for use in the monorepo, but, this directory may also contain external tools.
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
To disclose a security issue to our team, [please submit a report via HackerOne here](https://hackerone.com/automattic/).
|
||||
|
||||
## Support
|
||||
|
||||
This repository is not suitable for support. Please don't use our issue tracker for support requests, but for core WooCommerce issues only. Support can take place through the appropriate channels:
|
||||
|
||||
* If you have a problem, you may want to start with the [self help guide](https://docs.woocommerce.com/document/woocommerce-self-service-guide/).
|
||||
* The [WooCommerce.com premium support portal](https://woocommerce.com/contact-us/) for customers who have purchased themes or extensions.
|
||||
* [Our community forum on wp.org](https://wordpress.org/support/plugin/woocommerce) which is available for all WooCommerce users.
|
||||
* [The Official WooCommerce Facebook Group](https://www.facebook.com/groups/advanced.woocommerce).
|
||||
* For customizations, you may want to check our list of [WooExperts](https://woocommerce.com/experts/) or [Codeable](https://codeable.io/).
|
||||
- If you have a problem, you may want to start with the [self help guide](https://docs.woocommerce.com/document/woocommerce-self-service-guide/).
|
||||
- The [WooCommerce.com premium support portal](https://woocommerce.com/contact-us/) for customers who have purchased themes or extensions.
|
||||
- [Our community forum on wp.org](https://wordpress.org/support/plugin/woocommerce) which is available for all WooCommerce users.
|
||||
- [The Official WooCommerce Facebook Group](https://www.facebook.com/groups/advanced.woocommerce).
|
||||
- For customizations, you may want to check our list of [WooExperts](https://woocommerce.com/experts/) or [Codeable](https://codeable.io/).
|
||||
|
||||
NOTE: Unfortunately, we are unable to honor support requests in issues on this repository; as a result, any requests submitted in this manner will be closed.
|
||||
|
||||
## Community
|
||||
|
||||
For peer to peer support, real-time announcements, and office hours, please [join our slack community](https://woocommerce.com/community-slack/)!
|
||||
|
||||
## Contributing to WooCommerce
|
||||
|
||||
If you have a patch or have stumbled upon an issue with WooCommerce core, you can contribute this back to the code. Please read our [contributor guidelines](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md) for more information on how you can do this.
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
// Import the default config file and expose it in the project root.
|
||||
// Useful for editor integrations.
|
||||
module.exports = require( '@wordpress/prettier-config' );
|
|
@ -27,13 +27,7 @@ pnpm exec syncpack -- list-mismatches
|
|||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "You must sync the dependencies listed above before you can push this branch."
|
||||
echo "This can usually be accomplished automatically by updating the pinned version in `.syncpackrc` and then running \`pnpm run sync-dependencies\`."
|
||||
echo "This can usually be accomplished automatically by updating the pinned version in \`.syncpackrc\` and then running \`pnpm run sync-dependencies\`."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure both branches are tracked or check-changelogger-use will fail. Note we pass hooksPath
|
||||
# to avoid running the pre-commit hook.
|
||||
git -c core.hooksPath=/dev/null checkout $PROTECTED_BRANCH --quiet
|
||||
git -c core.hooksPath=/dev/null checkout $CURRENT_BRANCH --quiet
|
||||
|
||||
php tools/monorepo/check-changelogger-use.php $PROTECTED_BRANCH $CURRENT_BRANCH
|
||||
|
|
778
changelog.txt
778
changelog.txt
|
@ -1,5 +1,771 @@
|
|||
== Changelog ==
|
||||
|
||||
= 8.0.3 2023-08-29 =
|
||||
|
||||
* Update - Bump WooCommerce Blocks to 10.6.6. [#39853](https://github.com/woocommerce/woocommerce/pull/39853)
|
||||
* Fix - Avoid extra queries when a WooPayments incentive has been dismissed. [#39882](https://github.com/woocommerce/woocommerce/pull/39882)
|
||||
|
||||
|
||||
= 8.0.2 2023-08-15 =
|
||||
|
||||
* Fix - Fix an issue which was causing some attributes to default to a minimum length of 3. [#39686](https://github.com/woocommerce/woocommerce/pull/39686)
|
||||
|
||||
|
||||
= 8.0.1 2023-08-09 =
|
||||
|
||||
* Fix - bump WooCommerce blocks version to 10.6.5 [#39642](https://github.com/woocommerce/woocommerce/pull/39642)
|
||||
|
||||
|
||||
= 8.0.0 2023-08-08 =
|
||||
|
||||
**WooCommerce**
|
||||
|
||||
* Fix - Set the order table exist options value when its not present for smooth upgradation from lower WC versions. [#39616](https://github.com/woocommerce/woocommerce/pull/39616)
|
||||
* Fix - Add derivative features to legacy list so that warning is not generated for them. [#39537](https://github.com/woocommerce/woocommerce/pull/39537)
|
||||
* Fix - Dequeue blocktheme styles on WooCommerce Admin pages when product block editor is enabled. [#39478](https://github.com/woocommerce/woocommerce/pull/39478)
|
||||
* Fix - Do not disable "Used for variations" checkbox on attribute. [#39502](https://github.com/woocommerce/woocommerce/pull/39502)
|
||||
* Fix - Adds a grace period during which email verification will not be needed before the order confirmation (or payment) page is rendered. [#39191](https://github.com/woocommerce/woocommerce/pull/39191)
|
||||
* Fix - Fix turn off the new block experience when tracking is turned off [#39317](https://github.com/woocommerce/woocommerce/pull/39317)
|
||||
* Fix - Restore woocommerce_variations_added jQuery trigger. [#39301](https://github.com/woocommerce/woocommerce/pull/39301)
|
||||
* Fix - Add wrapper to the content generated by wc_empty_cart_message [[#38738]](https://github.com/woocommerce/woocommerce/pull/38738)
|
||||
* Fix - Allow to add custom metabox to custom order edit page by setting the correct screen id. [[#38938]](https://github.com/woocommerce/woocommerce/pull/38938)
|
||||
* Fix - Bootstrap server side block definitions [[#39027]](https://github.com/woocommerce/woocommerce/pull/39027)
|
||||
* Fix - Comment: Fix "Used for variations" checkbox being disabled on Variable products [[#39106]](https://github.com/woocommerce/woocommerce/pull/39106)
|
||||
* Fix - Convert DatabaseUtil::get_index_columns() to use SHOW INDEX FROM instead of INFORMATION_SCHEMA query [[#36427]](https://github.com/woocommerce/woocommerce/pull/36427)
|
||||
* Fix - Decrease product total sales when an order is reversed [[#37842]](https://github.com/woocommerce/woocommerce/pull/37842)
|
||||
* Fix - Do not show "Adding new attribute failed" error message when loading of product screens is interrupted by page unload. [[#38815]](https://github.com/woocommerce/woocommerce/pull/38815)
|
||||
* Fix - do not use image size cache while in customizer [[#38875]](https://github.com/woocommerce/woocommerce/pull/38875)
|
||||
* Fix - Fix attribute taxonomy templates when a templates for specific product attribute exists. [[#37552]](https://github.com/woocommerce/woocommerce/pull/37552)
|
||||
* Fix - Fixed failing shipping zones tests and cleaned up locators [[#38949]](https://github.com/woocommerce/woocommerce/pull/38949)
|
||||
* Fix - Fix grey background when menu is collapsed #38887 [[#38941]](https://github.com/woocommerce/woocommerce/pull/38941)
|
||||
* Fix - Fix links under "Help" panel on Home screen [[#38817]](https://github.com/woocommerce/woocommerce/pull/38817)
|
||||
* Fix - Fix Minimum Requirements in readme.txt file [[#39078]](https://github.com/woocommerce/woocommerce/pull/39078)
|
||||
* Fix - Fix the issue of stores sending frequent Helper API requests when the store databases disk is full. [[#37378]](https://github.com/woocommerce/woocommerce/pull/37378)
|
||||
* Fix - Fix the layout of View Cart link on the posts/pages [[#38950]](https://github.com/woocommerce/woocommerce/pull/38950)
|
||||
* Fix - Fix undismissable store alert when using language localization [[#38967]](https://github.com/woocommerce/woocommerce/pull/38967)
|
||||
* Fix - Fix unexpected gap on ipad and ipad mini [[#39108]](https://github.com/woocommerce/woocommerce/pull/39108)
|
||||
* Fix - Linting fix to webpack config. [[#38920]](https://github.com/woocommerce/woocommerce/pull/38920)
|
||||
* Fix - Make `WC_Order::get_item_subtotal()` always return a float. [[#36760]](https://github.com/woocommerce/woocommerce/pull/36760)
|
||||
* Fix - OrdersTableDataStore: capture and log errors when populating order properties [[#38840]](https://github.com/woocommerce/woocommerce/pull/38840)
|
||||
* Fix - Revert "Always show pricing group fields, disable if not available for a product type" [[#38964]](https://github.com/woocommerce/woocommerce/pull/38964)
|
||||
* Fix - Support dynamic prop setting to use in refunds for setting correct props. [[#39219]](https://github.com/woocommerce/woocommerce/pull/39219)
|
||||
* Fix - Trigger "woocommerce_newly_installed" hook for new installations [[#38694]](https://github.com/woocommerce/woocommerce/pull/38694)
|
||||
* Fix - When dormant customer accounts are removed, their content should be preserved. [[#38837]](https://github.com/woocommerce/woocommerce/pull/38837)
|
||||
* Fix - [HPOS] Backfill to post table only after order has persisted in orders table. [[#39196]](https://github.com/woocommerce/woocommerce/pull/39196)
|
||||
* Add - Add support for BG, CZ, HR, HU, RO and SE in WCPay [[#38109]](https://github.com/woocommerce/woocommerce/pull/38109)
|
||||
* Add - Add synchronization of deleted orders for HPOS [[#37050]](https://github.com/woocommerce/woocommerce/pull/37050)
|
||||
* Add - Add Variations tab to Product block editor [[#38921]](https://github.com/woocommerce/woocommerce/pull/38921)
|
||||
* Add - Allow registered React-powered pages to specify a parent navigation menu item to highlight when active. [[#39116]](https://github.com/woocommerce/woocommerce/pull/39116)
|
||||
* Add - Introduce the add and edit view Tracks events in the new form [[#39186]](https://github.com/woocommerce/woocommerce/pull/39186)
|
||||
* Add - Register woocommerce/product-variations-fields block [[#39038]](https://github.com/woocommerce/woocommerce/pull/39038)
|
||||
* Add - Removed Avalara from Tax task list item [[#39238]](https://github.com/woocommerce/woocommerce/pull/39238)
|
||||
* Add - Show create campaign button when there are campaign types in marketing page. [[#38825]](https://github.com/woocommerce/woocommerce/pull/38825)
|
||||
* Update - Update WooCommerce Blocks to 10.6.4 [#39582](https://github.com/woocommerce/woocommerce/pull/39582)
|
||||
* Update - Update WooCommerce Blocks to 10.6.3 [#39560](https://github.com/woocommerce/woocommerce/pull/39560)
|
||||
* Update - Update WooCommerce Blocks to 10.6.2 [#39492](https://github.com/woocommerce/woocommerce/pull/39492)
|
||||
* Update - Fix grammar in data-sharing agreement copy [#39327](https://github.com/woocommerce/woocommerce/pull/39327)
|
||||
* Update - Update WooCommerce Blocks to 10.6.1 [#39299](https://github.com/woocommerce/woocommerce/pull/39299)
|
||||
* Update - Add Klaviyo into onboarding marketing task list. [[#39087]](https://github.com/woocommerce/woocommerce/pull/39087)
|
||||
* Update - Analytics API: A new filter_empty parameter that allows to remove from result customers with given empty fields [[#38827]](https://github.com/woocommerce/woocommerce/pull/38827)
|
||||
* Update - Analytics API: Search for customers by all of the available fields instead of having to choose one [[#38628]](https://github.com/woocommerce/woocommerce/pull/38628)
|
||||
* Update - Branding rollout - change WooCommerce Payments to WooPayments [[#39188]](https://github.com/woocommerce/woocommerce/pull/39188)
|
||||
* Update - Change button text from "Install plugin" to "Install extension" in Marketing page. [[#39130]](https://github.com/woocommerce/woocommerce/pull/39130)
|
||||
* Update - Remove TikTok from plugin suggestion list [[#39135]](https://github.com/woocommerce/woocommerce/pull/39135)
|
||||
* Update - Update the call to marketing extensions recommendations API from version 1.2 to version 1.3 with new recommendation Klaviyo. [[#38974]](https://github.com/woocommerce/woocommerce/pull/38974)
|
||||
* Update - Update WooCommerce Blocks to 10.6.0 [[#39144]](https://github.com/woocommerce/woocommerce/pull/39144)
|
||||
* Update - Use wp_json_encode instead of print_r in output for HPOS-related WP CLI commands. [[#38699]](https://github.com/woocommerce/woocommerce/pull/38699)
|
||||
* Dev - Add more assertions to `can add custom product attributes` E2E test. [[#39139]](https://github.com/woocommerce/woocommerce/pull/39139)
|
||||
* Dev - Add pnpm commands for easier PHP linting [[#38727]](https://github.com/woocommerce/woocommerce/pull/38727)
|
||||
* Dev - Cleanup global state after testing `wc_load_cart()`. [[#39136]](https://github.com/woocommerce/woocommerce/pull/39136)
|
||||
* Dev - Enable HPOS through the `wp option` command. [[#39095]](https://github.com/woocommerce/woocommerce/pull/39095)
|
||||
* Dev - Ensure `can discard industry changes when navigating back to "Store Details"'` can run independent from previous tests [[#38715]](https://github.com/woocommerce/woocommerce/pull/38715)
|
||||
* Dev - Fix skipping of core profiler in page-loads.spec.js. [[#39084]](https://github.com/woocommerce/woocommerce/pull/39084)
|
||||
* Dev - Improvements to the DI related unit testing infrastructure [[#38849]](https://github.com/woocommerce/woocommerce/pull/38849)
|
||||
* Dev - Replace deprecated page methods. [[#38344]](https://github.com/woocommerce/woocommerce/pull/38344)
|
||||
* Dev - Skip failing e2e test preventing PRs being merged. GH fails but local works [[#38855]](https://github.com/woocommerce/woocommerce/pull/38855)
|
||||
* Dev - Update locators in `order-emails` and `order-email-receiving` specs so that they pass on WP 6.3. [[#39159]](https://github.com/woocommerce/woocommerce/pull/39159)
|
||||
* Dev - Update locators in `order-emails` spec, and use the latest version of WP Mail Logging. [[#39013]](https://github.com/woocommerce/woocommerce/pull/39013)
|
||||
* Dev - Update pnpm monorepo-wide to 8.6.5 [[#38990]](https://github.com/woocommerce/woocommerce/pull/38990)
|
||||
* Dev - Update `wp-env` to version 8.2.0. [[#39100]](https://github.com/woocommerce/woocommerce/pull/39100)
|
||||
* Dev - Use grunt-contrib-uglify-es to handle legacy es6" [[#38342]](https://github.com/woocommerce/woocommerce/pull/38342)
|
||||
* Tweak - Add autoFocus attribute to product-name-field block [[#39050]](https://github.com/woocommerce/woocommerce/pull/39050)
|
||||
* Tweak - Corrects a minor issue (incorrect HTML markup) in the System Status Report. [[#39053]](https://github.com/woocommerce/woocommerce/pull/39053)
|
||||
* Tweak - Remove letter-spacing from the core profiler headers; Use 500 for font-weight. [[#39042]](https://github.com/woocommerce/woocommerce/pull/39042)
|
||||
* Tweak - Replace "Proceed" with "Continue" to be more consistent [[#38961]](https://github.com/woocommerce/woocommerce/pull/38961)
|
||||
* Tweak - Restore user's plugin selection when there is an installation error [[#38922]](https://github.com/woocommerce/woocommerce/pull/38922)
|
||||
* Tweak - Update CSS styles for the core profiler header [[#39059]](https://github.com/woocommerce/woocommerce/pull/39059)
|
||||
* Tweak - Use existing table instead of 'DUAL' to support hosts which do not support 'DUAL'. [[#39111]](https://github.com/woocommerce/woocommerce/pull/39111)
|
||||
* Tweak - When detecting which plugins are WooCommerce-aware, improve accuracy by ignoring cached plugin data. [[#38836]](https://github.com/woocommerce/woocommerce/pull/38836)
|
||||
* Tweak - When displaying partial consumer keys in the REST API settings, replace ellipses with asterisks.
|
||||
* Enhancement - Add action for 'order_edit_form_top' as a replacement to edit_form_top for HPOS. [[#39165]](https://github.com/woocommerce/woocommerce/pull/39165)
|
||||
* Enhancement - Add filter `woocommerce_redirect_order_location` for consistency with posts and HPOS. [[#39193]](https://github.com/woocommerce/woocommerce/pull/39193)
|
||||
* Enhancement - New product block editor modal text enhancements [[#39055]](https://github.com/woocommerce/woocommerce/pull/39055)
|
||||
* Enhancement - Refresh UX to enable HPOS to make it user friendly. [[#38993]](https://github.com/woocommerce/woocommerce/pull/38993)
|
||||
|
||||
|
||||
= 7.9.0 2023-07-17 =
|
||||
|
||||
**WooCommerce**
|
||||
|
||||
* Fix - Fix frontend styles not loading in the site editor. [#38769](https://github.com/woocommerce/woocommerce/pull/38769)
|
||||
* Fix - Perform feature flag change and redirection in the same request and remove feature related query args after enabling/disabling it [#38833](https://github.com/woocommerce/woocommerce/pull/38833)
|
||||
* Fix - Eliminate woocommerce_cart_item_name filter running twice on cart.php template [#38999](https://github.com/woocommerce/woocommerce/pull/38999)
|
||||
* Fix - Override /jetpack/v4/connection/data to return 404 to fix conflict with Android app flow [#38987](https://github.com/woocommerce/woocommerce/pull/38987)
|
||||
* Fix - Use window.location.href for page redirection to get the latest onboarding profile values on the Homescreen [#38861](https://github.com/woocommerce/woocommerce/pull/38861)
|
||||
* Fix - Fix core profiler UI bugs [#38872](https://github.com/woocommerce/woocommerce/pull/38872)
|
||||
* Fix - Remove feature related query args after enabling/disabling it [#38852](https://github.com/woocommerce/woocommerce/pull/38852)
|
||||
* Fix - Add product_block_editor to legacy_feature_ids. [#38835](https://github.com/woocommerce/woocommerce/pull/38835)
|
||||
* Fix - Add "PrepareUrl" transformer to RIM rules processor [[#38312]](https://github.com/woocommerce/woocommerce/pull/38312)
|
||||
* Fix - Add another check in base location rule to fix OBW extensions bug [[#38794]](https://github.com/woocommerce/woocommerce/pull/38794)
|
||||
* Fix - add cart cookie validation [[#38294]](https://github.com/woocommerce/woocommerce/pull/38294)
|
||||
* Fix - add HPOSToggleTrait.php to unit test loader [[#38684]](https://github.com/woocommerce/woocommerce/pull/38684)
|
||||
* Fix - Address possible PHP warning in wc-admin/options REST endpoint. [[#38685]](https://github.com/woocommerce/woocommerce/pull/38685)
|
||||
* Fix - Add support for taxonomy meta boxes in HPOS order edit screen. [[#38676]](https://github.com/woocommerce/woocommerce/pull/38676)
|
||||
* Fix - Allow plugins_page_skipped parameter in Onboarding API endpoint [[#38764]](https://github.com/woocommerce/woocommerce/pull/38764)
|
||||
* Fix - cast url to string for str_replace [[#38530]](https://github.com/woocommerce/woocommerce/pull/38530)
|
||||
* Fix - CES modal: styling fixes and extraFiels prop added [[#38643]](https://github.com/woocommerce/woocommerce/pull/38643)
|
||||
* Fix - Default to the first state in a country for the country dropdown options when only the country was previously saved [[#38469]](https://github.com/woocommerce/woocommerce/pull/38469)
|
||||
* Fix - Ensure order ordering in order filter unit test [[#38680]](https://github.com/woocommerce/woocommerce/pull/38680)
|
||||
* Fix - ensure parameter datatype for array_slice [[#38529]](https://github.com/woocommerce/woocommerce/pull/38529)
|
||||
* Fix - Filter by date_paid and date_completed on list table orders based on configuration [[#38428]](https://github.com/woocommerce/woocommerce/pull/38428)
|
||||
* Fix - Fire bulk action orders hook for all custom actions. [[#38747]](https://github.com/woocommerce/woocommerce/pull/38747)
|
||||
* Fix - Fix 'dynamic property declaration' warnings in wc-admin code (PHP 8.2+). [[#38587]](https://github.com/woocommerce/woocommerce/pull/38587)
|
||||
* Fix - Fix block grouping within a section [[#38325]](https://github.com/woocommerce/woocommerce/pull/38325)
|
||||
* Fix - Fix character encoding detection in CSV exporter for PHP 8.1 [[#38648]](https://github.com/woocommerce/woocommerce/pull/38648)
|
||||
* Fix - fix deprecated warning in dashboard setup [[#38776]](https://github.com/woocommerce/woocommerce/pull/38776)
|
||||
* Fix - Fix dynamic property declaration warnings in gateway code (PHP 8.2+). [[#38566]](https://github.com/woocommerce/woocommerce/pull/38566)
|
||||
* Fix - Fix dynamic property declaration warnings in HPOS code (PHP 8.2+) [[#38565]](https://github.com/woocommerce/woocommerce/pull/38565)
|
||||
* Fix - Fix dynamic property declaration warnings in shipping-related code (PHP 8.2+). [[#38569]](https://github.com/woocommerce/woocommerce/pull/38569)
|
||||
* Fix - Fixed a visual bug where text overlapped the image in the task list header. [[#38707]](https://github.com/woocommerce/woocommerce/pull/38707)
|
||||
* Fix - Fix infinite redirect from homescreen when onboarding isn't completed using useEffect to remove unintentional rerendering [[#38768]](https://github.com/woocommerce/woocommerce/pull/38768)
|
||||
* Fix - Fix Layout Controller forwarding arrays from the URL query string. [[#38593]](https://github.com/woocommerce/woocommerce/pull/38593)
|
||||
* Fix - Fix number of orders under tax report [[#38525]](https://github.com/woocommerce/woocommerce/pull/38525)
|
||||
* Fix - Fix overlapping TransientNotices with footer [[#38698]](https://github.com/woocommerce/woocommerce/pull/38698)
|
||||
* Fix - Fix payment gateway suggestions display logic, added IN to paypal gateway visible rule, updated tests, improved comments [[#38658]](https://github.com/woocommerce/woocommerce/pull/38658)
|
||||
* Fix - Fix selection of multiple orders in HPOS list table. [[#38749]](https://github.com/woocommerce/woocommerce/pull/38749)
|
||||
* Fix - Fix Shipping Methods autosaving entire form. [[#38431]](https://github.com/woocommerce/woocommerce/pull/38431)
|
||||
* Fix - fix string + string for PHP 8.X [[#38534]](https://github.com/woocommerce/woocommerce/pull/38534)
|
||||
* Fix - fix Unsupported operand string * float [[#38532]](https://github.com/woocommerce/woocommerce/pull/38532)
|
||||
* Fix - Fix various 'dynamic property declaration' warnings on PHP 8.2+. [[#38589]](https://github.com/woocommerce/woocommerce/pull/38589)
|
||||
* Fix - Handle possibly empty refund value in reports (PHP 8.1+). [[#38683]](https://github.com/woocommerce/woocommerce/pull/38683)
|
||||
* Fix - improve get_children transient validation [[#38666]](https://github.com/woocommerce/woocommerce/pull/38666)
|
||||
* Fix - Minor UI fixes in Core profiler steps [[#38759]](https://github.com/woocommerce/woocommerce/pull/38759)
|
||||
* Fix - Redirect users to WooCommerce Home when Jetpack auth endpoint returns an invalid URL. [[#38760]](https://github.com/woocommerce/woocommerce/pull/38760)
|
||||
* Fix - Support custom editor-only blocks in the block-based product editor. [[#38495]](https://github.com/woocommerce/woocommerce/pull/38495)
|
||||
* Fix - Support values written in exponential notation for HPOS migrations. [[#38561]](https://github.com/woocommerce/woocommerce/pull/38561)
|
||||
* Fix - Update status only when it's changed. [[#38696]](https://github.com/woocommerce/woocommerce/pull/38696)
|
||||
* Fix - Do not show "Adding new attribute failed" error message when loading of product screens is interrupted by page unload. [[#38815]](https://github.com/woocommerce/woocommerce/pull/38815)
|
||||
* Add - Add source property to product tracking data [#38728](https://github.com/woocommerce/woocommerce/pull/38728)
|
||||
* Add - Add an admin notice about the upcoming PHP version requirement change for PHP 7.3 users [[#38604]](https://github.com/woocommerce/woocommerce/pull/38604)
|
||||
* Add - Add an animated spinner to the Core Profiler to be displayed when assets are loading. [[#38598]](https://github.com/woocommerce/woocommerce/pull/38598)
|
||||
* Add - Added ability for the core profiler state machine to navigate by using the 'step' URL query param [[#38620]](https://github.com/woocommerce/woocommerce/pull/38620)
|
||||
* Add - Added business info page to new core profiler [[#38412]](https://github.com/woocommerce/woocommerce/pull/38412)
|
||||
* Add - Add Jetpack Connection package [[#38674]](https://github.com/woocommerce/woocommerce/pull/38674)
|
||||
* Add - Add plugins page to the core profiler [[#38405]](https://github.com/woocommerce/woocommerce/pull/38405)
|
||||
* Add - Add properties and methods for detecting order admin screens more easily. [[#38417]](https://github.com/woocommerce/woocommerce/pull/38417)
|
||||
* Add - Add re-migrate support to HPOS CLI. [[#38690]](https://github.com/woocommerce/woocommerce/pull/38690)
|
||||
* Add - Add Saint Kitts and Nevis parishes [[#38621]](https://github.com/woocommerce/woocommerce/pull/38621)
|
||||
* Add - Add support to change features through the url as query parameters [[#38551]](https://github.com/woocommerce/woocommerce/pull/38551)
|
||||
* Add - Allow filtering HPOS order queries. [[#36625]](https://github.com/woocommerce/woocommerce/pull/36625)
|
||||
* Add - Implement the product blocks experiment within code for new users [[#38700]](https://github.com/woocommerce/woocommerce/pull/38700)
|
||||
* Add - Override the interface skeleton container so it can be scrollable [[#38484]](https://github.com/woocommerce/woocommerce/pull/38484)
|
||||
* Add - Product Editor Onboarding: Add About the editor... option the more menu in product block editor [[#38691]](https://github.com/woocommerce/woocommerce/pull/38691)
|
||||
* Add - Provide a data-store agnostic way of untrashing orders. [[#38670]](https://github.com/woocommerce/woocommerce/pull/38670)
|
||||
* Add - Replace 'use classic editor' with 'Turn off the new product editor' in options menu#38575 [[#38693]](https://github.com/woocommerce/woocommerce/pull/38693)
|
||||
* Add - Show feedback bar after product block editor tour/guide [[#38669]](https://github.com/woocommerce/woocommerce/pull/38669)
|
||||
* Add - Show feedback bar for product editor. [[#38599]](https://github.com/woocommerce/woocommerce/pull/38599)
|
||||
* Add - Show spotlight for first time visitors of block product editor [[#38590]](https://github.com/woocommerce/woocommerce/pull/38590)
|
||||
* Add - Updated payment gateway suggestions for 2023 Q3 [[#38646]](https://github.com/woocommerce/woocommerce/pull/38646)
|
||||
* Update - Update WooCommerce Blocks to 10.4.5 [#39048](https://github.com/woocommerce/woocommerce/pull/39048)
|
||||
* Update - Update WooCommerce Blocks to 10.4.4 [#38918](https://github.com/woocommerce/woocommerce/pull/38918)
|
||||
* Update - Redirect to the old editor when attempting to edit a non-supported product type [#38745](https://github.com/woocommerce/woocommerce/pull/38745)
|
||||
* Update - Update WooCommerce Blocks to 10.4.3 [#38839](https://github.com/woocommerce/woocommerce/pull/38839)
|
||||
* Update - Add 'Tell me more' button to end of block editor tour for more information [[#38639]](https://github.com/woocommerce/woocommerce/pull/38639)
|
||||
* Update - Add descriptive document titles to HPOS order admin screens [[#38617]](https://github.com/woocommerce/woocommerce/pull/38617)
|
||||
* Update - Add obw/core-profiler to the free-extensions endpoint [[#38418]](https://github.com/woocommerce/woocommerce/pull/38418)
|
||||
* Update - Adds info about features and plugin compatibility to the data collected by WC Tracker [[#38613]](https://github.com/woocommerce/woocommerce/pull/38613)
|
||||
* Update - CSS change to change the hover color of select options [[#38724]](https://github.com/woocommerce/woocommerce/pull/38724)
|
||||
* Update - Disable 'Used for variations' checkbox when product type is not variable [[#38802]](https://github.com/woocommerce/woocommerce/pull/38802)
|
||||
* Update - Enable core-profiler flag to replace profile wizard with the new core profiler [[#38729]](https://github.com/woocommerce/woocommerce/pull/38729)
|
||||
* Update - Expand WCPay Switch incentive to more countries and include a new action incentive. [[#38689]](https://github.com/woocommerce/woocommerce/pull/38689)
|
||||
* Update - Fix DefaultShippingPartners data mismatch [[#38457]](https://github.com/woocommerce/woocommerce/pull/38457)
|
||||
* Update - Make option API fail when using a disallowed option name in non-produciton environments [[#38388]](https://github.com/woocommerce/woocommerce/pull/38388)
|
||||
* Update - Remove icons from product editor template [[#38351]](https://github.com/woocommerce/woocommerce/pull/38351)
|
||||
* Update - Remove StoreDetails task when core-profiler flag is on [[#38722]](https://github.com/woocommerce/woocommerce/pull/38722)
|
||||
* Update - Renamed install-async to install-activate-async to activate installed plugins [[#38434]](https://github.com/woocommerce/woocommerce/pull/38434)
|
||||
* Update - Set woocommerce_onboarding_profile.skipped when guided set is skipped [[#38730]](https://github.com/woocommerce/woocommerce/pull/38730)
|
||||
* Update - Update "Set up additional payment" task view & complete logic [[#38273]](https://github.com/woocommerce/woocommerce/pull/38273)
|
||||
* Update - Update Action Scheduler to 3.6.1. [[#38721]](https://github.com/woocommerce/woocommerce/pull/38721)
|
||||
* Update - Update WooCommerce Blocks to 10.2.2 [[#38545]](https://github.com/woocommerce/woocommerce/pull/38545)
|
||||
* Update - Update WooCommerce Blocks to 10.4.0 [[#38656]](https://github.com/woocommerce/woocommerce/pull/38656)
|
||||
* Update - Update WooCommerce Blocks to 10.4.2 [[#38656]](https://github.com/woocommerce/woocommerce/pull/38656)
|
||||
* Update - Update WooCommerce Blocks to 10.4.6 [[#39278]](https://github.com/woocommerce/woocommerce/pull/39278)
|
||||
* Update - Use coreprofiler_ prefix for core profiler track names [[#38710]](https://github.com/woocommerce/woocommerce/pull/38710)
|
||||
* Update - Visual changes for the core profiler pages -- intro, guided setup, and skipped guided setup pages [[#38709]](https://github.com/woocommerce/woocommerce/pull/38709)
|
||||
* Update - WCPay welcome incentive logic minor addition [[#38803]](https://github.com/woocommerce/woocommerce/pull/38803)
|
||||
* Update - WCPay welcome incentive logic [[#38797]](https://github.com/woocommerce/woocommerce/pull/38797)
|
||||
* Update - Track checkboxes and selects in Settings > Emails settings and fix XHR request error when updating shipping zone configurations. [[#38834]](https://github.com/woocommerce/woocommerce/pull/38834)
|
||||
* Dev - Add a composer script to run phpcs-changed against the current branch [[#38085]](https://github.com/woocommerce/woocommerce/pull/38085)
|
||||
* Dev - Added new hook `woocommerce_admin_order_data_after_payment_info` allowing extensions to render content in order details payment info metabox. [[#38443]](https://github.com/woocommerce/woocommerce/pull/38443)
|
||||
* Dev - Add HPOS compat queries for tracker. [[#38293]](https://github.com/woocommerce/woocommerce/pull/38293)
|
||||
* Dev - Add null-coalerscing operators for compatibility with PHP 8 [[#38008]](https://github.com/woocommerce/woocommerce/pull/38008)
|
||||
* Dev - Adjust wc-formatting-functions.php null args deprecations in PHP 8.1 [[#38635]](https://github.com/woocommerce/woocommerce/pull/38635)
|
||||
* Dev - Fix flakiness in `can set variation defaults` test. [[#38672]](https://github.com/woocommerce/woocommerce/pull/38672)
|
||||
* Dev - Lint fixes [[#38523]](https://github.com/woocommerce/woocommerce/pull/38523)
|
||||
* Dev - Move Reports-related code to reduce duplicates. [[#38048]](https://github.com/woocommerce/woocommerce/pull/38048)
|
||||
* Dev - Refactored Core Profiler's plugin installation step to use XState [[#38577]](https://github.com/woocommerce/woocommerce/pull/38577)
|
||||
* Dev - Refactored core profiler state machine by modularising each page [[#38606]](https://github.com/woocommerce/woocommerce/pull/38606)
|
||||
* Dev - Removed page spinners between core profiler pages and added a button spinner instead [[#38750]](https://github.com/woocommerce/woocommerce/pull/38750)
|
||||
* Dev - Tidied up core profiler's tracks actions [[#38603]](https://github.com/woocommerce/woocommerce/pull/38603)
|
||||
* Dev - Update Codisto extension description and fix WooCommerce name typo in test. [[#38302]](https://github.com/woocommerce/woocommerce/pull/38302)
|
||||
* Dev - Update woocommerce_suggest_jetpack filter description [[#38501]](https://github.com/woocommerce/woocommerce/pull/38501)
|
||||
* Tweak - Address edge-cases around Incentives eligibility and display. [#39207](https://github.com/woocommerce/woocommerce/pull/39207)
|
||||
* Tweak - Prefetch Jetpack connection and auth info when Jetpack is selected [#38929](https://github.com/woocommerce/woocommerce/pull/38929)
|
||||
* Tweak - Always pass default product type options to product_type_options filter [#38854](https://github.com/woocommerce/woocommerce/pull/38854)
|
||||
* Tweak - Decode HTML entities for the store name [[#38791]](https://github.com/woocommerce/woocommerce/pull/38791)
|
||||
* Tweak - Doc block tweak, no changelog necessary [[#38630]](https://github.com/woocommerce/woocommerce/pull/38630)
|
||||
* Tweak - Don't show confirmation message when removing a non-variation attribute from a product. [[#38386]](https://github.com/woocommerce/woocommerce/pull/38386)
|
||||
* Tweak - Do not execute order's page controller logic outside of orders screens. [[#38641]](https://github.com/woocommerce/woocommerce/pull/38641)
|
||||
* Tweak - Do not show HPOS plugin incompat warning to users with insufficient access permissions. [[#38535]](https://github.com/woocommerce/woocommerce/pull/38535)
|
||||
* Tweak - Fixed race condition in core profiler's plugin list fetching and also minor spinner fixes [[#38732]](https://github.com/woocommerce/woocommerce/pull/38732)
|
||||
* Tweak - Improve compatibility between GTM and the single product page.
|
||||
* Tweak - Swap out deprecated jQuery ready handlers [[#37320]](https://github.com/woocommerce/woocommerce/pull/37320)
|
||||
* Tweak - Update CSS styles for the core profiler header [[#37320]](https://github.com/woocommerce/woocommerce/pull/39059)
|
||||
* Enhancement - Additional changes for the core profiler plugins page [[#38616]](https://github.com/woocommerce/woocommerce/pull/38616)
|
||||
* Enhancement - Fixed visibility and tax values convert to lowercase as issue facing in importing. [[#33820]](https://github.com/woocommerce/woocommerce/pull/33820)
|
||||
* Enhancement - Loader design changes for the core profiler [[#38750]](https://github.com/woocommerce/woocommerce/pull/38750)
|
||||
* Enhancement - Update product editor tour/guide copy and style. [[#38726]](https://github.com/woocommerce/woocommerce/pull/38726)
|
||||
|
||||
|
||||
= 7.8.2 2023-07-04 =
|
||||
|
||||
**WooCommerce**
|
||||
|
||||
* Fix - Add missing require for a wc-admin helper function. [#39030](https://github.com/woocommerce/woocommerce/pull/39030)
|
||||
|
||||
|
||||
= 7.8.1 2023-06-27 =
|
||||
|
||||
**WooCommerce**
|
||||
|
||||
* Update - Update WooCommerce Blocks to 10.2.4 [#38891](https://github.com/woocommerce/woocommerce/pull/38891)
|
||||
* Fix - Do not show "Adding new attribute failed" error message when loading of product screens is interrupted by page unload. [[#38815]](https://github.com/woocommerce/woocommerce/pull/38815)
|
||||
* Tweak - Always pass default product type options to product_type_options filter. [[#38854]](https://github.com/woocommerce/woocommerce/pull/38854)
|
||||
|
||||
|
||||
|
||||
= 7.8.0 2023-06-13 =
|
||||
|
||||
**WooCommerce**
|
||||
|
||||
* Fix - Fix a bug where text overlapped the image in the task list header. [#38585](https://github.com/woocommerce/woocommerce/pull/38585)
|
||||
* Fix - Fix issue where undefined query params where not removed from links, causing unexpected behaviour in Analytics. [#38542](https://github.com/woocommerce/woocommerce/pull/38542)
|
||||
* Fix - Above notification threshold when "Out of stock threshold" filed value is empty [[#37855]](https://github.com/woocommerce/woocommerce/pull/37855)
|
||||
* Fix - Added numeric check for Regular price in bulk edits. [[#37812]](https://github.com/woocommerce/woocommerce/pull/37812)
|
||||
* Fix - add missing aria-label attributes to help tips [[#37808]](https://github.com/woocommerce/woocommerce/pull/37808)
|
||||
* Fix - add refunded_payment property in the create refund response [[#37816]](https://github.com/woocommerce/woocommerce/pull/37816)
|
||||
* Fix - Add support to verify specific order types. [[#38318]](https://github.com/woocommerce/woocommerce/pull/38318)
|
||||
* Fix - Add the product name to the "Remove from cart" button's aria-label in the cart and mini cart. [[#37830]](https://github.com/woocommerce/woocommerce/pull/37830)
|
||||
* Fix - Clear floats in Twenty Twenty Three theme on Related products and Upsells. [[#37877]](https://github.com/woocommerce/woocommerce/pull/37877)
|
||||
* Fix - Ensure the remove icon shows properly on smaller screens when using the Twenty Twenty One theme [[#37859]](https://github.com/woocommerce/woocommerce/pull/37859)
|
||||
* Fix - Fix "Add store details" task fails to mark as completed for selecting Nigeria based address [[#38181]](https://github.com/woocommerce/woocommerce/pull/38181)
|
||||
* Fix - Fix: when order is deleted child orders should be deleted too, not set to parent id 0, unless the post type for the order is hierarchical [[#38199]](https://github.com/woocommerce/woocommerce/pull/38199)
|
||||
* Fix - Fix activity panel not showing unread when closed [[#38173]](https://github.com/woocommerce/woocommerce/pull/38173)
|
||||
* Fix - Fix decimal points for SEK, HUF and CZK currencies [[#37834]](https://github.com/woocommerce/woocommerce/pull/37834)
|
||||
* Fix - Fixed Cross-Sells display variable product [[#37616]](https://github.com/woocommerce/woocommerce/pull/37616)
|
||||
* Fix - Fixes a race condition when adding the first attribute form to the product edit screen. [[#38354]](https://github.com/woocommerce/woocommerce/pull/38354)
|
||||
* Fix - Fix get_options deprecation notice [[#38289]](https://github.com/woocommerce/woocommerce/pull/38289)
|
||||
* Fix - Fix loading sample product's progress message is misaligned if Gutenberg plugin is enabled [[#38107]](https://github.com/woocommerce/woocommerce/pull/38107)
|
||||
* Fix - fix logout vs log out typo [[#35232]](https://github.com/woocommerce/woocommerce/pull/35232)
|
||||
* Fix - Fix product task import for cases when user locale is en_US [[#38089]](https://github.com/woocommerce/woocommerce/pull/38089)
|
||||
* Fix - Fix race condition that caused some store alerts to be undismissable [[#38047]](https://github.com/woocommerce/woocommerce/pull/38047)
|
||||
* Fix - Fix shipping tour layout context error [[#38183]](https://github.com/woocommerce/woocommerce/pull/38183)
|
||||
* Fix - fix stock status is not correct in JSON structure data if product is onbackorder [[#37837]](https://github.com/woocommerce/woocommerce/pull/37837)
|
||||
* Fix - Fix task list progress title when no tasks are completed [[#38092]](https://github.com/woocommerce/woocommerce/pull/38092)
|
||||
* Fix - Fix tracks user ID mismatch between PHP and JS when Jetpack is active and connected [[#38094]](https://github.com/woocommerce/woocommerce/pull/38094)
|
||||
* Fix - Fix wc-experimental not translated issue [[#38108]](https://github.com/woocommerce/woocommerce/pull/38108)
|
||||
* Fix - Fix wrong file name in error message in update-wp-env.php. [[#37891]](https://github.com/woocommerce/woocommerce/pull/37891)
|
||||
* Fix - For the Twenty Twenty One theme, reduce padding within notices on smaller screens [[#37862]](https://github.com/woocommerce/woocommerce/pull/37862)
|
||||
* Fix - Hide state selector for Ethiopia and Rwanda addresses [[#35481]](https://github.com/woocommerce/woocommerce/pull/35481)
|
||||
* Fix - Hide upload logo step in Personalize task if theme doesn't support it [[#38161]](https://github.com/woocommerce/woocommerce/pull/38161)
|
||||
* Fix - No warning shown for zero price. [[#37817]](https://github.com/woocommerce/woocommerce/pull/37817)
|
||||
* Fix - Prevented an issue with height flickering when selecting a variation [[#38115]](https://github.com/woocommerce/woocommerce/pull/38115)
|
||||
* Fix - Prevent login call if the user is already logged in. [[#37850]](https://github.com/woocommerce/woocommerce/pull/37850)
|
||||
* Fix - Prevents error in Customers API endpoint when date_created value is missing [[#37860]](https://github.com/woocommerce/woocommerce/pull/37860)
|
||||
* Fix - Removed aria-disabled attribute from "Update Cart" button as it already has a disabled attribute. [[#37820]](https://github.com/woocommerce/woocommerce/pull/37820)
|
||||
* Fix - Remove the default text in "Additional content" being sent for all emails when the field is empty for Admin New Order email [[#37883]](https://github.com/woocommerce/woocommerce/pull/37883)
|
||||
* Fix - Removing auto-draft as wc post type to resolve publish time bug. [[#38099]](https://github.com/woocommerce/woocommerce/pull/38099)
|
||||
* Fix - replace title HTML attribute with aria-label for quantity input field [[#37811]](https://github.com/woocommerce/woocommerce/pull/37811)
|
||||
* Fix - Save an order created via the REST API to prevent overrides from 3rd party plugins or themes if they try to add fees to the order. [[#37845]](https://github.com/woocommerce/woocommerce/pull/37845)
|
||||
* Fix - Show correct confirmation message when removing an attribute from a product. [[#38355]](https://github.com/woocommerce/woocommerce/pull/38355)
|
||||
* Fix - Show correct variations count when generating a single variation. [[#37876]](https://github.com/woocommerce/woocommerce/pull/37876)
|
||||
* Fix - skip k6 api order RUD tests on non-existent order when C test fails [[#37887]](https://github.com/woocommerce/woocommerce/pull/37887)
|
||||
* Fix - skip k6 batch update when batch create fails [[#38282]](https://github.com/woocommerce/woocommerce/pull/38282)
|
||||
* Fix - Support strict SQL modes in HPOS migration that dont allow zero date values. [[#38332]](https://github.com/woocommerce/woocommerce/pull/38332)
|
||||
* Fix - use correct escaping function [[#36868]](https://github.com/woocommerce/woocommerce/pull/36868)
|
||||
* Fix - Use waitUntil instead of waitForLoadState in page.goto() and page.click(). [[#37831]](https://github.com/woocommerce/woocommerce/pull/37831)
|
||||
* Fix - When creating default storefront pages, the site language (and not the language of the current user) should be used. [[#37795]](https://github.com/woocommerce/woocommerce/pull/37795)
|
||||
* Fix - Fix Layout Controller forwarding arrays from the URL query string. [#38593](https://github.com/woocommerce/woocommerce/pull/38593)
|
||||
* Add - Added SSR to WCCOM endpoints. [#38433](https://github.com/woocommerce/woocommerce/pull/38433)
|
||||
* Add - Add admin-side order edit lock for HPOS. [[#38230]](https://github.com/woocommerce/woocommerce/pull/38230)
|
||||
* Add - Add a filter to exclude Jetpack from suggested free extensions REST endpoint. [[#38286]](https://github.com/woocommerce/woocommerce/pull/38286)
|
||||
* Add - Add a function to get the aria-describedby description for the add to cart button.
|
||||
Add default description for the Select options button. [[#37880]](https://github.com/woocommerce/woocommerce/pull/37880)
|
||||
* Add - Add Business Location page to the new core profiler [[#38019]](https://github.com/woocommerce/woocommerce/pull/38019)
|
||||
* Add - Add core profiler "Welcome to Woo" page [[#37952]](https://github.com/woocommerce/woocommerce/pull/37952)
|
||||
* Add - Add core profiler user profile page [[#38328]](https://github.com/woocommerce/woocommerce/pull/38328)
|
||||
* Add - Add description block to product editor template [[#37852]](https://github.com/woocommerce/woocommerce/pull/37852)
|
||||
* Add - Add e2e test for Merchant > Pages > Can create a new page [[#38238]](https://github.com/woocommerce/woocommerce/pull/38238)
|
||||
* Add - Add e2e test for Merchant > Posts > Can create a new post [[#38041]](https://github.com/woocommerce/woocommerce/pull/38041)
|
||||
* Add - Added async fetching for extensions and countries lists in new core profiler [[#38270]](https://github.com/woocommerce/woocommerce/pull/38270)
|
||||
* Add - Added scaffolding for new core profiler [[#37628]](https://github.com/woocommerce/woocommerce/pull/37628)
|
||||
* Add - Add HPOS specific k6 test suite [[#37665]](https://github.com/woocommerce/woocommerce/pull/37665)
|
||||
* Add - Adding order attributes to product tabs template. [[#38081]](https://github.com/woocommerce/woocommerce/pull/38081)
|
||||
* Add - Add navigation and progress-bar componentns for the new core profiler [[#37741]](https://github.com/woocommerce/woocommerce/pull/37741)
|
||||
* Add - Add Sale price validation#37985 [[#38078]](https://github.com/woocommerce/woocommerce/pull/38078)
|
||||
* Add - add support for minlenght in the template [[#37840]](https://github.com/woocommerce/woocommerce/pull/37840)
|
||||
* Add - Add tinymce scripts to product editor pages [[#38175]](https://github.com/woocommerce/woocommerce/pull/38175)
|
||||
* Add - Add unresolved assets for iframe editors to editor settings [[#37570]](https://github.com/woocommerce/woocommerce/pull/37570)
|
||||
* Add - Add WooCommerce Admin page class to body of every page [[#38281]](https://github.com/woocommerce/woocommerce/pull/38281)
|
||||
* Add - Create orders as 'auto-draft' by default in admin. [[#37643]](https://github.com/woocommerce/woocommerce/pull/37643)
|
||||
* Add - Get feature flags from client side [[#37122]](https://github.com/woocommerce/woocommerce/pull/37122)
|
||||
* Add - Only register blocks when user navigates to the product edit page#38200 [[#38303]](https://github.com/woocommerce/woocommerce/pull/38303)
|
||||
* Add - Show the number of variations imported [[#37829]](https://github.com/woocommerce/woocommerce/pull/37829)
|
||||
* Add - Track stock quantity for this product should be disabled when Enable stock management within settings is disabled, and enabled otherwise [[#37957]](https://github.com/woocommerce/woocommerce/pull/37957)
|
||||
* Add - Update List price Pricing link on the general tab to navigate to the Pricing tab [[#37961]](https://github.com/woocommerce/woocommerce/pull/37961)
|
||||
* Add - Update shipping class block to match new designs#38044 [[#38301]](https://github.com/woocommerce/woocommerce/pull/38301)
|
||||
* Update - Update WooCommerce Blocks to 10.2.3 [#38663](https://github.com/woocommerce/woocommerce/pull/38663)
|
||||
* Update - Update WooCommerce Blocks to 10.2.2 [#38545](https://github.com/woocommerce/woocommerce/pull/38545)
|
||||
* Update - Update WooCommerce Blocks to 10.2.1 [#38449](https://github.com/woocommerce/woocommerce/pull/38449)
|
||||
* Update - Add action hooks to WC_Abstract_Order::remove_order_items [[#37822]](https://github.com/woocommerce/woocommerce/pull/37822)
|
||||
* Update - Add new REST endpoints at onboarding/plugins to support async plugin installation with real time error tracking. [[#38174]](https://github.com/woocommerce/woocommerce/pull/38174)
|
||||
* Update - add pagination navigation below Settings Tax list table [[#37916]](https://github.com/woocommerce/woocommerce/pull/37916)
|
||||
* Update - Add support for `showHeader` config in router config to hide header if needed. [[#38247]](https://github.com/woocommerce/woocommerce/pull/38247)
|
||||
* Update - Add tracks events to shipping settings [[#38305]](https://github.com/woocommerce/woocommerce/pull/38305)
|
||||
* Update - Always show the product variations empty state with message when there are no "used for variations" attributes on a product. [[#38358]](https://github.com/woocommerce/woocommerce/pull/38358)
|
||||
* Update - Change product-category-metabox JS/style enqueue logic [[#38076]](https://github.com/woocommerce/woocommerce/pull/38076)
|
||||
* Update - Fallback to simply not display any prices rather than empty prices and re-enable Purchase unit tests [[#38163]](https://github.com/woocommerce/woocommerce/pull/38163)
|
||||
* Update - In the WC Tracker, group payment methods and origins ignoring unique ids within their names. [[#37951]](https://github.com/woocommerce/woocommerce/pull/37951)
|
||||
* Update - Loading svgs in product block template by URL. [[#37869]](https://github.com/woocommerce/woocommerce/pull/37869)
|
||||
* Update - Make all fields in the tax location form mandatory [[#38137]](https://github.com/woocommerce/woocommerce/pull/38137)
|
||||
* Update - Moving AddNewShippingClass modal to product-editor package. [[#37968]](https://github.com/woocommerce/woocommerce/pull/37968)
|
||||
* Update - Moving product attributes components to product-editor package. [[#38051]](https://github.com/woocommerce/woocommerce/pull/38051)
|
||||
* Update - Moving product block editor styling to prdouct editor package. [[#37805]](https://github.com/woocommerce/woocommerce/pull/37805)
|
||||
* Update - Only add product template when new editor feature flag is enabled. [[#38276]](https://github.com/woocommerce/woocommerce/pull/38276)
|
||||
* Update - Remove Core onboarding usage of woocommerce_updated hook [[#38158]](https://github.com/woocommerce/woocommerce/pull/38158)
|
||||
* Update - Remove sample data from product templates [[#38343]](https://github.com/woocommerce/woocommerce/pull/38343)
|
||||
* Update - Replacing hardcoded info and error notices with the correct wp_print_notice functions. [[#37514]](https://github.com/woocommerce/woocommerce/pull/37514)
|
||||
* Update - Update Category product metabox with an async dropdown search control rendered with React. [[#36869]](https://github.com/woocommerce/woocommerce/pull/36869)
|
||||
* Update - Update current block names to reflect use case and avoid conflicts#37704 [[#37851]](https://github.com/woocommerce/woocommerce/pull/37851)
|
||||
* Update - Updated product description tips text. [[#38070]](https://github.com/woocommerce/woocommerce/pull/38070)
|
||||
* Update - Update empty state for product attributes tab. [[#38126]](https://github.com/woocommerce/woocommerce/pull/38126)
|
||||
* Update - Update Payfast's title and logo [[#38090]](https://github.com/woocommerce/woocommerce/pull/38090)
|
||||
* Update - Update product template to include category section and block. [[#37295]](https://github.com/woocommerce/woocommerce/pull/37295)
|
||||
* Update - Update transformers doc with examples [[#38176]](https://github.com/woocommerce/woocommerce/pull/38176)
|
||||
* Update - Update WooCommerce Blocks to 10.2.0 [[#38246]](https://github.com/woocommerce/woocommerce/pull/38246)
|
||||
* Update - Update Woo to L-1 support policy for 7.8 [[#37970]](https://github.com/woocommerce/woocommerce/pull/37970)
|
||||
* Update - Updating product editor block template to include stock status and refactor others. [[#37906]](https://github.com/woocommerce/woocommerce/pull/37906)
|
||||
* Update - Updating the usage of LayoutContext and moving to admin-layout package. [[#37720]](https://github.com/woocommerce/woocommerce/pull/37720)
|
||||
* Update - Use snackbar instead of alert when showing generated variations message. [[#38103]](https://github.com/woocommerce/woocommerce/pull/38103)
|
||||
* Update - Woo Blocks 10.0.4 [[#38135]](https://github.com/woocommerce/woocommerce/pull/38135)
|
||||
* Dev - Added model based testing for new core profiler [[#38154]](https://github.com/woocommerce/woocommerce/pull/38154)
|
||||
* Dev - Added xstate inspector toggling via localStorage flag and dev node environment, and eslint xstate plugin [[#38022]](https://github.com/woocommerce/woocommerce/pull/38022)
|
||||
* Dev - Add Gutenberg nightly and latest stable into the daily and release smoke tests. [[#38287]](https://github.com/woocommerce/woocommerce/pull/38287)
|
||||
* Dev - Add instruction to run Playwright UI mode in E2E readme. [[#38197]](https://github.com/woocommerce/woocommerce/pull/38197)
|
||||
* Dev - Add missing woocommerce_run_on_woocommerce_admin_updated hook for the scheduled action registered in RemoteInboxNotificationsEngine [[#38159]](https://github.com/woocommerce/woocommerce/pull/38159)
|
||||
* Dev - Add the ability to skip the `review-testing-instructions` workflow when the PR is from an external contributor. [[#37813]](https://github.com/woocommerce/woocommerce/pull/37813)
|
||||
* Dev - Break down the "create-variable-product" spec into smaller specs. [[#38335]](https://github.com/woocommerce/woocommerce/pull/38335)
|
||||
* Dev - Cleanup task list and organize tasks file structure [[#38271]](https://github.com/woocommerce/woocommerce/pull/38271)
|
||||
* Dev - Correct URL and assertion in merchant/add-order perf test. [[#37719]](https://github.com/woocommerce/woocommerce/pull/37719)
|
||||
* Dev - Increase default timeout and test timeout of create-variable-product spec. [[#38321]](https://github.com/woocommerce/woocommerce/pull/38321)
|
||||
* Dev - Migrate tasks fills index.js, purchase.tsx and related utils to TS [[#37725]](https://github.com/woocommerce/woocommerce/pull/37725)
|
||||
* Dev - Modify 'WC_Settings_Tracking' to allow dropdown options recording for WooCommerce Settings [[#38035]](https://github.com/woocommerce/woocommerce/pull/38035)
|
||||
* Dev - Optimize installation routine by reducing the number of DELETE statments for admin notices. [[#37472]](https://github.com/woocommerce/woocommerce/pull/37472)
|
||||
* Dev - Register server-side tracking during rest requests [[#37796]](https://github.com/woocommerce/woocommerce/pull/37796)
|
||||
* Dev - Remove daily.playwright.config.js and references to it. [[#38336]](https://github.com/woocommerce/woocommerce/pull/38336)
|
||||
* Dev - Removed wp-env workaround since the bug has been fixed [[#38326]](https://github.com/woocommerce/woocommerce/pull/38326)
|
||||
* Dev - remove unused deasync dependency [[#37821]](https://github.com/woocommerce/woocommerce/pull/37821)
|
||||
* Dev - Remove `qs` dependency from `woocommerce-admin` [[#35128]](https://github.com/woocommerce/woocommerce/pull/35128)
|
||||
* Dev - Update Playwright to 1.33 and introduce UI command [[#38100]](https://github.com/woocommerce/woocommerce/pull/38100)
|
||||
* Dev - Update pnpm to version 8. [[#37915]](https://github.com/woocommerce/woocommerce/pull/37915)
|
||||
* Dev - Update stable tag to 7.6.1 [[#38006]](https://github.com/woocommerce/woocommerce/pull/38006)
|
||||
* Dev - Update tasklist documentation/example [[#38245]](https://github.com/woocommerce/woocommerce/pull/38245)
|
||||
* Dev - Update the E2E test timeout to 90 sec, and update the E2E README. [[#38288]](https://github.com/woocommerce/woocommerce/pull/38288)
|
||||
* Dev - Update the WSL setup instructions in the readme. [[#37819]](https://github.com/woocommerce/woocommerce/pull/37819)
|
||||
* Dev - Use locator.fill to fill variation values in the form instead of page.fill [[#37854]](https://github.com/woocommerce/woocommerce/pull/37854)
|
||||
* Dev - Variations - Remove separator between buttons and empty state screen [[#38123]](https://github.com/woocommerce/woocommerce/pull/38123)
|
||||
* Dev - Variations - Rename Generate variations button after variations are created. [[#38084]](https://github.com/woocommerce/woocommerce/pull/38084)
|
||||
* Tweak - Add a 24px spacing to store management body [[#38088]](https://github.com/woocommerce/woocommerce/pull/38088)
|
||||
* Tweak - Add context to translatable strings for credit card labels. [[#36364]](https://github.com/woocommerce/woocommerce/pull/36364)
|
||||
* Tweak - Add product type options tracking to product publish and update events. [[#38017]](https://github.com/woocommerce/woocommerce/pull/38017)
|
||||
* Tweak - Correct spelling errors [[#37887]](https://github.com/woocommerce/woocommerce/pull/37887)
|
||||
* Tweak - Fix spelling errors in Remote Inbox Notifications Transformers documentation. [[#38387]](https://github.com/woocommerce/woocommerce/pull/38387)
|
||||
* Tweak - Fix styling of product data field descriptions, including checkboxes and radio buttons. [[#38066]](https://github.com/woocommerce/woocommerce/pull/38066)
|
||||
* Tweak - Fix typo in a function comment. [[#37829]](https://github.com/woocommerce/woocommerce/pull/37829)
|
||||
* Tweak - Improve spacing of product gallery thumbs when using the Twenty Twenty-Two theme. [[#35491]](https://github.com/woocommerce/woocommerce/pull/35491)
|
||||
* Tweak - Makes more information available to handlers for the `checkout_place_order` (and related) events. [[#38147]](https://github.com/woocommerce/woocommerce/pull/38147)
|
||||
* Tweak - Update plugin listing description [[#38074]](https://github.com/woocommerce/woocommerce/pull/38074)
|
||||
* Tweak - Update usage of AdvancedFilter to use createInterpolateElement formats. [[#37967]](https://github.com/woocommerce/woocommerce/pull/37967)
|
||||
* Performance - Compute if any order is pending, when deciding to process next migration batch [[#38165]](https://github.com/woocommerce/woocommerce/pull/38165)
|
||||
* Performance - Removed global enqueue of wc-cart-fragments. Moved to the cart widget (its main consumer). [[#35530]](https://github.com/woocommerce/woocommerce/pull/35530)
|
||||
* Enhancement - Add default styles for product meta in the TT3 order details table [[#38172]](https://github.com/woocommerce/woocommerce/pull/38172)
|
||||
* Enhancement - Added a button to download SSR to a file. [[#38110]](https://github.com/woocommerce/woocommerce/pull/38110)
|
||||
* Enhancement - Added missing button element classes in account orders and downloads pages [[#37933]](https://github.com/woocommerce/woocommerce/pull/37933)
|
||||
* Enhancement - Add order note to display held stock inventory to provide more visibility to merchants. [[#37833]](https://github.com/woocommerce/woocommerce/pull/37833)
|
||||
* Enhancement - Change from using a figure to using a div around the single product image to improve accessibility [[#37853]](https://github.com/woocommerce/woocommerce/pull/37853)
|
||||
* Enhancement - Fix comment list styling in TT2 [[#37894]](https://github.com/woocommerce/woocommerce/pull/37894)
|
||||
* Enhancement - Fixed the attributes table styling in TT3 tabs content area [[#37895]](https://github.com/woocommerce/woocommerce/pull/37895)
|
||||
* Enhancement - Order is search with the phone number and linked with the customer/user account. [[#37844]](https://github.com/woocommerce/woocommerce/pull/37844)
|
||||
* Enhancement - Print blocks-based CSS classes only when a FSE theme is used [[#37631]](https://github.com/woocommerce/woocommerce/pull/37631)
|
||||
* Enhancement - Rename tracks event product_attributes_add to product_attributes_save on the product page and update attributes [[#38278]](https://github.com/woocommerce/woocommerce/pull/38278)
|
||||
* Enhancement - When deleting an administrator user, any existing webhook(s) owned to the user being deleted are re-assigned to the nominated user if the "Attribute all content to" option is chosen, or re-assigned to user id zero. This helps avoid `woocommerce_rest_cannot_view` webhook payload errors. [[#37814]](https://github.com/woocommerce/woocommerce/pull/37814)
|
||||
|
||||
= 7.7.2 2023-06-01 =
|
||||
|
||||
**WooCommerce**
|
||||
|
||||
* Update - Update WooCommerce Blocks to 10.0.6 [#38533](https://github.com/woocommerce/woocommerce/pull/38533)
|
||||
|
||||
= 7.7.1 2023-05-26 =
|
||||
|
||||
**WooCommerce**
|
||||
|
||||
* Update - Update WooCommerce Blocks to 10.0.5 [#38427](https://github.com/woocommerce/woocommerce/pull/38427)
|
||||
|
||||
|
||||
= 7.7.0 2023-05-10 =
|
||||
|
||||
**WooCommerce**
|
||||
|
||||
* Fix - Removing auto-draft as wc post type to resolve publish time bug. [#38099](https://github.com/woocommerce/woocommerce/pull/38099)
|
||||
* Fix - Handle updating customer when user_registered is 0000-00-00 00:00:00. [#37907](https://github.com/woocommerce/woocommerce/pull/37907)
|
||||
* Fix - Sync up date_column_name default for orders table, between stats and table data. [#37927](https://github.com/woocommerce/woocommerce/pull/37927)
|
||||
* Fix - Fix regression in supporting nested date query arguments in HPOS. [#37827](https://github.com/woocommerce/woocommerce/pull/37827)
|
||||
* Fix - Fix disabled "Save attributes" button [#37790](https://github.com/woocommerce/woocommerce/pull/37790)
|
||||
* Fix - Accessibility update for product_categories shortcode. [#37445](https://github.com/woocommerce/woocommerce/pull/37445)
|
||||
* Fix - Add sort order to migration script for consistency. [#37545](https://github.com/woocommerce/woocommerce/pull/37545)
|
||||
* Fix - Add support for end_at ID to allow partial verification. [#37446](https://github.com/woocommerce/woocommerce/pull/37446)
|
||||
* Fix - Avoid over-aggressive escaping of the payment gateway title in the context of the checkout thank you page. [#37481](https://github.com/woocommerce/woocommerce/pull/37481)
|
||||
* Fix - Corrects imported ContainerInterface. It was not replaced because of the leading backslash. [#37334](https://github.com/woocommerce/woocommerce/pull/37334)
|
||||
* Fix - Delete shipping zone count transient on woocommerce_shipping_zone_method_added and woocommerce_after_shipping_zone_object_save [#37693](https://github.com/woocommerce/woocommerce/pull/37693)
|
||||
* Fix - Delete tax lookup and order stats database records when an order is deleted while orders table is authoritative [#36601](https://github.com/woocommerce/woocommerce/pull/36601)
|
||||
* Fix - fixed bug where adjust_download_permissions was being scheduled on variable products without downloadable variations [#34828](https://github.com/woocommerce/woocommerce/pull/34828)
|
||||
* Fix - Fixed the attributes table styling in TT2 tabs content area [#37639](https://github.com/woocommerce/woocommerce/pull/37639)
|
||||
* Fix - Fix ellipsis menu overlaps on small screen [#37583](https://github.com/woocommerce/woocommerce/pull/37583)
|
||||
* Fix - Fixes a failing e2e test for product variations [#37246](https://github.com/woocommerce/woocommerce/pull/37246)
|
||||
* Fix - Fix global button aria-disabled style [#37461](https://github.com/woocommerce/woocommerce/pull/37461)
|
||||
* Fix - Fix incorrect variable name in api-core-tests [#37388](https://github.com/woocommerce/woocommerce/pull/37388)
|
||||
* Fix - Fix missing result prop in wcadmin_install_plugin_error track [#37466](https://github.com/woocommerce/woocommerce/pull/37466)
|
||||
* Fix - Fix special characters not rendered in admin titles [#37546](https://github.com/woocommerce/woocommerce/pull/37546)
|
||||
* Fix - Fix table alias issue in order field queries. [#37560](https://github.com/woocommerce/woocommerce/pull/37560)
|
||||
* Fix - Fix the type for order items in the schema definition of REST API v1 and V2 [#35940](https://github.com/woocommerce/woocommerce/pull/35940)
|
||||
* Fix - Lock the product block editor template root [#37685](https://github.com/woocommerce/woocommerce/pull/37685)
|
||||
* Fix - Make migration more strict by removing IGNORE [#37595](https://github.com/woocommerce/woocommerce/pull/37595)
|
||||
* Fix - Minor fixup for getting order ids in verify db command. [#37576](https://github.com/woocommerce/woocommerce/pull/37576)
|
||||
* Fix - Refetch data for "Installed extensions" card after installing a recommended marketing channel. [#37300](https://github.com/woocommerce/woocommerce/pull/37300)
|
||||
* Fix - Remove double checking for woocommerce_tax_display_cart filter. [#37617](https://github.com/woocommerce/woocommerce/pull/37617)
|
||||
* Fix - Remove unique constraint from order_key, since orders can be created with empty order keys, which then conflict with the constraint. [#37594](https://github.com/woocommerce/woocommerce/pull/37594)
|
||||
* Fix - Removing modification to rest_namespace on post type and replacing with middleware. [#37621](https://github.com/woocommerce/woocommerce/pull/37621)
|
||||
* Fix - Replace information_schema queries in favor of create table parsing to remove foreign key constraints during updates [#37299](https://github.com/woocommerce/woocommerce/pull/37299)
|
||||
* Fix - Restores comments (reviews) to the product editor. [#37457](https://github.com/woocommerce/woocommerce/pull/37457)
|
||||
* Fix - Revert changes to use window.fetch in legacy cart JS [#37463](https://github.com/woocommerce/woocommerce/pull/37463)
|
||||
* Fix - Synchronized SSR from template to REST API. [#37425](https://github.com/woocommerce/woocommerce/pull/37425)
|
||||
* Fix - Updates an e2e variable name to be more descriptive [#37448](https://github.com/woocommerce/woocommerce/pull/37448)
|
||||
* Fix - update select all to checkbox in menu editor [#37562](https://github.com/woocommerce/woocommerce/pull/37562)
|
||||
* Fix - Use first meta value for HPOS migration when there are duplicates for flat column. [#37676](https://github.com/woocommerce/woocommerce/pull/37676)
|
||||
* Fix - Hide stock status field if stock management is enabled. [#37890](https://github.com/woocommerce/woocommerce/pull/37890)
|
||||
* Add - Add plugin installer version independent of WP cron. [#37753](https://github.com/woocommerce/woocommerce/pull/37753)
|
||||
* Add - Add a category for product editor blocks [#37347](https://github.com/woocommerce/woocommerce/pull/37347)
|
||||
* Add - Add country query param to payment gateway data sources [#37443](https://github.com/woocommerce/woocommerce/pull/37443)
|
||||
* Add - Add image configuration to the product block template [#37340](https://github.com/woocommerce/woocommerce/pull/37340)
|
||||
* Add - Add images block to product editor template [#37455](https://github.com/woocommerce/woocommerce/pull/37455)
|
||||
* Add - add import webp support [#37307](https://github.com/woocommerce/woocommerce/pull/37307)
|
||||
* Add - Adding charge sales tax field to product block editor template. [#37582](https://github.com/woocommerce/woocommerce/pull/37582)
|
||||
* Add - Adding checkbox, conditional and inventory email blocks to product blocks editor. [#37646](https://github.com/woocommerce/woocommerce/pull/37646)
|
||||
* Add - Adding inventory section and sku blocks to product block editor. [#37623](https://github.com/woocommerce/woocommerce/pull/37623)
|
||||
* Add - Add method delete_meta_data_value to WC_Data objects [#37667](https://github.com/woocommerce/woocommerce/pull/37667)
|
||||
* Add - Add methods to OrderUtil to get the names of order database tables [#37624](https://github.com/woocommerce/woocommerce/pull/37624)
|
||||
* Add - Add pricing section to the pricing tab [#37513](https://github.com/woocommerce/woocommerce/pull/37513)
|
||||
* Add - Add product editor blocks to assets build folder [#37318](https://github.com/woocommerce/woocommerce/pull/37318)
|
||||
* Add - Add product schedule sale pricing block to blocks template definition [#37567](https://github.com/woocommerce/woocommerce/pull/37567)
|
||||
* Add - Add product shipping fee block to blocks template definition [#37642](https://github.com/woocommerce/woocommerce/pull/37642)
|
||||
* Add - Add summary block [#37302](https://github.com/woocommerce/woocommerce/pull/37302)
|
||||
* Add - Add tax class to product editor template [#37529](https://github.com/woocommerce/woocommerce/pull/37529)
|
||||
* Add - Add tracks events to attributes tab [#37622](https://github.com/woocommerce/woocommerce/pull/37622)
|
||||
* Add - Add tracks events to variations tab [#37607](https://github.com/woocommerce/woocommerce/pull/37607)
|
||||
* Add - Add Woo Payments feature slotfill on homepage [#37768](https://github.com/woocommerce/woocommerce/pull/37768)
|
||||
* Add - Allows the WP, WC & PHP version to be specified in .wp-env.json for e2e and api tests [#37587](https://github.com/woocommerce/woocommerce/pull/37587)
|
||||
* Add - Change variations dropdown menu visibility [#37558](https://github.com/woocommerce/woocommerce/pull/37558)
|
||||
* Add - Register product track inventory block [#37585](https://github.com/woocommerce/woocommerce/pull/37585)
|
||||
* Add - Register woocommerce/product-shipping-dimensions-fields block [#37683](https://github.com/woocommerce/woocommerce/pull/37683)
|
||||
* Update - Update WooCommerce Blocks to 10.0.2 [#37818](https://github.com/woocommerce/woocommerce/pull/37818)
|
||||
* Update - Update WC Blocks to include changes from 9.9.0, 10.0.0 and 10.0.1 [#37662](https://github.com/woocommerce/woocommerce/pull/37662)
|
||||
* Update - Add default priority for countries that are not in the payment recommendation map [#37590](https://github.com/woocommerce/woocommerce/pull/37590)
|
||||
* Update - Add Payoneer, zipco payment gateways and update Klarna available countries [#37329](https://github.com/woocommerce/woocommerce/pull/37329)
|
||||
* Update - Filter out marketing channels in "Installed extensions" and "Discover more marketing tools" cards. [#37126](https://github.com/woocommerce/woocommerce/pull/37126)
|
||||
* Update - FlexSlider always uses Web Animations API for "slide" animations. [#36987](https://github.com/woocommerce/woocommerce/pull/36987)
|
||||
* Update - Make Multichannel Marketing the default new UI for Marketing page; remove classic Marketing page and unused code. [#37430](https://github.com/woocommerce/woocommerce/pull/37430)
|
||||
* Update - Migrate steps location task to TS [#37257](https://github.com/woocommerce/woocommerce/pull/37257)
|
||||
* Update - Refactoring product editor more menu items, and using in block editor slot fills. [#37255](https://github.com/woocommerce/woocommerce/pull/37255)
|
||||
* Update - Register product editor blocks server-side [#37339](https://github.com/woocommerce/woocommerce/pull/37339)
|
||||
* Update - Remove multichannel marketing info from WC Tracker [#37438](https://github.com/woocommerce/woocommerce/pull/37438)
|
||||
* Update - Remove theme step from onboarding wizard [#37671](https://github.com/woocommerce/woocommerce/pull/37671)
|
||||
* Update - Replacing multiple components on the block product page with a single hook. [#37283](https://github.com/woocommerce/woocommerce/pull/37283)
|
||||
* Update - Show different error message when deleting an attribute used in variations [#37527](https://github.com/woocommerce/woocommerce/pull/37527)
|
||||
* Update - Show tooltip in Save attributes button instead of using title attribute [#37345](https://github.com/woocommerce/woocommerce/pull/37345)
|
||||
* Update - Support min_php_version and min_wp_version for the free extensions feed [#37694](https://github.com/woocommerce/woocommerce/pull/37694)
|
||||
* Update - Update payment gateway recommendation priority [#37442](https://github.com/woocommerce/woocommerce/pull/37442)
|
||||
* Update - Update textdomain in woocommerce-blocks *.json files to `woocommerce` [#37234](https://github.com/woocommerce/woocommerce/pull/37234)
|
||||
* Dev - Fix recent failures in "Smoke test release" workflow. [#37783](https://github.com/woocommerce/woocommerce/pull/37783)
|
||||
* Dev - Add composer scripts for linting with phpcs-changed [#37465](https://github.com/woocommerce/woocommerce/pull/37465)
|
||||
* Dev - Add tracks event to gather onboarding heuristics [#37767](https://github.com/woocommerce/woocommerce/pull/37767)
|
||||
* Dev - Bump required PHP version to 7.3 and PHPUnit version to 9 [#37366](https://github.com/woocommerce/woocommerce/pull/37366)
|
||||
* Dev - Code refactor on marketing components. [#37444](https://github.com/woocommerce/woocommerce/pull/37444)
|
||||
* Dev - Dev - Add customer object parameter to taxable address filter [#37426](https://github.com/woocommerce/woocommerce/pull/37426)
|
||||
* Dev - Dev - Allow to filter wc_help_tip [#37485](https://github.com/woocommerce/woocommerce/pull/37485)
|
||||
* Dev - Fix WP latest-2 version retrieval in the "Smoke test release" workflow. [#37675](https://github.com/woocommerce/woocommerce/pull/37675)
|
||||
* Dev - Item controls for attribute creation are always visible [#37620](https://github.com/woocommerce/woocommerce/pull/37620)
|
||||
* Dev - Migrate woocommerce-payments task to TS and remove connect.js from task fills [#37308](https://github.com/woocommerce/woocommerce/pull/37308)
|
||||
* Dev - Move additional CES-related components to @woocommerce/customer-effort-score. [#37316](https://github.com/woocommerce/woocommerce/pull/37316)
|
||||
* Dev - Move components to @woocommerce/product-editor [#37131](https://github.com/woocommerce/woocommerce/pull/37131)
|
||||
* Dev - New empty state for variations - no variations have been created yet [#37411](https://github.com/woocommerce/woocommerce/pull/37411)
|
||||
* Dev - Reduce flakiness on E2E test setup. [#37410](https://github.com/woocommerce/woocommerce/pull/37410)
|
||||
* Dev - Rename the default placeholder in the new attribute form header to New attribute [#37645](https://github.com/woocommerce/woocommerce/pull/37645)
|
||||
* Dev - Replaced `example.org` in tests with WP_TESTS_DOMAIN for consistency with WordPress Core. [#37742](https://github.com/woocommerce/woocommerce/pull/37742)
|
||||
* Dev - Reset variable product tour after running e2e tests. [#37680](https://github.com/woocommerce/woocommerce/pull/37680)
|
||||
* Dev - Run E2E tests on PR merge to trunk. [#37033](https://github.com/woocommerce/woocommerce/pull/37033)
|
||||
* Dev - Set quantity value when stock tracking is enabled [#37304](https://github.com/woocommerce/woocommerce/pull/37304)
|
||||
* Dev - Simplify boolean expression before && in Marketing page. [#37452](https://github.com/woocommerce/woocommerce/pull/37452)
|
||||
* Dev - Smoke test WooCommerce with plugins installed on releases. [#37361](https://github.com/woocommerce/woocommerce/pull/37361)
|
||||
* Dev - Split can create product, attributes and variations, edit variations and delete variations into smaller tests to avoid timing out [#37733](https://github.com/woocommerce/woocommerce/pull/37733)
|
||||
* Dev - Update webpack config to use @woocommerce/internal-style-build's parser config [#37195](https://github.com/woocommerce/woocommerce/pull/37195)
|
||||
* Tweak - Update plugin listing description [#38074](https://github.com/woocommerce/woocommerce/pull/38074)
|
||||
* Tweak - Changed label for button to add a new global attribute value from the product screen. [#37414](https://github.com/woocommerce/woocommerce/pull/37414)
|
||||
* Tweak - Default to sorting orders by date (desc) when HPOS is active. [#37565](https://github.com/woocommerce/woocommerce/pull/37565)
|
||||
* Tweak - Exclude empty attributes from the attribute count when tracking product updates. [#37718](https://github.com/woocommerce/woocommerce/pull/37718)
|
||||
* Tweak - Fix typo in a function comment. [#37746](https://github.com/woocommerce/woocommerce/pull/37746)
|
||||
* Tweak - Fix typo in Stats controller [#37407](https://github.com/woocommerce/woocommerce/pull/37407)
|
||||
* Tweak - Fix typos in comments in REST API customers controller [#37405](https://github.com/woocommerce/woocommerce/pull/37405)
|
||||
* Tweak - Remove the multichannel marketing feature flag from database since it's the default option now. [#37454](https://github.com/woocommerce/woocommerce/pull/37454)
|
||||
* Tweak - Remove timeouts in e2e tests for variable products and analytics. [#37335](https://github.com/woocommerce/woocommerce/pull/37335)
|
||||
* Tweak - Update mobile app image resolution [#37506](https://github.com/woocommerce/woocommerce/pull/37506)
|
||||
* Tweak - Update style of product attributes tab empty state. [#37429](https://github.com/woocommerce/woocommerce/pull/37429)
|
||||
* Tweak - Update to the merchant variable product e2e test [#37714](https://github.com/woocommerce/woocommerce/pull/37714)
|
||||
* Performance - Improve search count query performance by avoiding LEFT JOIN in favor of subquery. [#36688](https://github.com/woocommerce/woocommerce/pull/36688)
|
||||
* Enhancement - Added a button to download SSR to a file. [#38110](https://github.com/woocommerce/woocommerce/pull/38110)
|
||||
* Enhancement - Added a woocommerce_disable_api_access_log filter to disable last access logging for rest api. [#37332](https://github.com/woocommerce/woocommerce/pull/37332)
|
||||
* Enhancement - Fix rounding difference on refunds with per-line taxes [#34641](https://github.com/woocommerce/woocommerce/pull/34641)
|
||||
* Enhancement - Show info message when on variations tab and no attributes have been assigned to product. [#37352](https://github.com/woocommerce/woocommerce/pull/37352)
|
||||
* Enhancement - Show tour when product type is changed to variable. [#37413](https://github.com/woocommerce/woocommerce/pull/37413)
|
||||
|
||||
|
||||
= 7.6.1 2023-04-26 =
|
||||
|
||||
**WooCommerce**
|
||||
|
||||
* Fix - Fix regression in supporting nested date query arguments in HPOS. [#37827](https://github.com/woocommerce/woocommerce/pull/37827)
|
||||
* Fix - Sync up date_column_name default for orders table, between stats and table data. [#37927](https://github.com/woocommerce/woocommerce/pull/37927)
|
||||
* Fix - Revert "Change Variations form shown in Variations tab when there are no variations created (#36957)" [#37889](https://github.com/woocommerce/woocommerce/pull/37889)
|
||||
* Fix – Revert changes to use window.fetch in legacy cart JS [#37463](https://github.com/woocommerce/woocommerce/pull/37463)
|
||||
* Update - Update WooCommerce Blocks to 9.8.5 [#37921](https://github.com/woocommerce/woocommerce/pull/37921)
|
||||
|
||||
= 7.6.0 2023-04-13 =
|
||||
|
||||
**WooCommerce**
|
||||
|
||||
* Fix - Fix incorrect usage of dispatch, useSelect, and setState calls in homescreen along with settings and onboarding package [#37641](https://github.com/woocommerce/woocommerce/pull/37641)
|
||||
* Fix - Do not attempt to cache order during order creation (HPOS). [#37569](https://github.com/woocommerce/woocommerce/pull/37569)
|
||||
* Fix - Add default value when calling get_option for woocommerce_task_list_tracked_completed_tasks. [#37397](https://github.com/woocommerce/woocommerce/pull/37397)
|
||||
* Fix - When order meta data is saved via HPOS, it should be backfilled to the CPT data store. [#36593](https://github.com/woocommerce/woocommerce/pull/36593)
|
||||
* Fix - Overwrite clone method to prevent duplicate data when saving a clone. [#37313](https://github.com/woocommerce/woocommerce/pull/37313)
|
||||
* Fix - Add default button padding to TT2 stylesheet to fix some visual issues in WP 5.9 and 6.0 [#37018](https://github.com/woocommerce/woocommerce/pull/37018)
|
||||
* Fix - Added skydropx slug back to shipping partners list so that it can be installed through the shipping task [#37286](https://github.com/woocommerce/woocommerce/pull/37286)
|
||||
* Fix - Add HPOS compat for admin report functions. [#36650](https://github.com/woocommerce/woocommerce/pull/36650)
|
||||
* Fix - Add HPOS compat for wc-user-functions.php. [#36650](https://github.com/woocommerce/woocommerce/pull/36650)
|
||||
* Fix - Add support for null inputs to pnpm wc_add_number_precision [#36891](https://github.com/woocommerce/woocommerce/pull/36891)
|
||||
* Fix - Add support for `after`, `before`, `modified_after` and `modified_before` params in local timezone. [#36650](https://github.com/woocommerce/woocommerce/pull/36650)
|
||||
* Fix - Add validation when saving attributes and variations [#37046](https://github.com/woocommerce/woocommerce/pull/37046)
|
||||
* Fix - Also delete when order type is placehoder, since it was created by HPOS. [#36650](https://github.com/woocommerce/woocommerce/pull/36650)
|
||||
* Fix - Corrects a class reference in the ProductDownloadsServiceProvider. [#37052](https://github.com/woocommerce/woocommerce/pull/37052)
|
||||
* Fix - Corrects a variable name in Reports\Stock\Stats. It was missed during the last name change. [#37057](https://github.com/woocommerce/woocommerce/pull/37057)
|
||||
* Fix - Corrects class namespaces in Onboarding. It was missed during last restructuring. [#37056](https://github.com/woocommerce/woocommerce/pull/37056)
|
||||
* Fix - Corrects imported classes. Class names should not begin with a backslash. [#37058](https://github.com/woocommerce/woocommerce/pull/37058)
|
||||
* Fix - Ensure product importer imports all lines in a CSV file. [#36839](https://github.com/woocommerce/woocommerce/pull/36839)
|
||||
* Fix - Fetch order first to refresh cache before returning prop. [#36650](https://github.com/woocommerce/woocommerce/pull/36650)
|
||||
* Fix - Fix 0 rendered on short-circuit evaluation. [#37104](https://github.com/woocommerce/woocommerce/pull/37104)
|
||||
* Fix - Fix ArrayUtil::get_value_or_default method not behaving as documented for null array values [#37053](https://github.com/woocommerce/woocommerce/pull/37053)
|
||||
* Fix - Fix blank screen is displayed during OBW when using WP5.9 [#36903](https://github.com/woocommerce/woocommerce/pull/36903)
|
||||
* Fix - Fix duplicated global attribute [#37109](https://github.com/woocommerce/woocommerce/pull/37109)
|
||||
* Fix - fixed bug where jetpack connection owner field was assumed to be username when its actually display name [#37170](https://github.com/woocommerce/woocommerce/pull/37170)
|
||||
* Fix - Fixed payments recommendations pane in WooCommerce Payment Settings using the wrong image prop [#37259](https://github.com/woocommerce/woocommerce/pull/37259)
|
||||
* Fix - Fixes filtering by attributes in the Analytics Orders and Variations reports. [#37223](https://github.com/woocommerce/woocommerce/pull/37223)
|
||||
* Fix - Fix incorrect VAT exempt behaviour on shop page when prices are exclusive of tax. [#33991](https://github.com/woocommerce/woocommerce/pull/33991)
|
||||
* Fix - Fix React rendering falsy value in marketing page. [#37227](https://github.com/woocommerce/woocommerce/pull/37227)
|
||||
* Fix - Fix the inability to apply a coupon whose code is "0" [#36924](https://github.com/woocommerce/woocommerce/pull/36924)
|
||||
* Fix - fix typo in variable name [#36759](https://github.com/woocommerce/woocommerce/pull/36759)
|
||||
* Fix - Fix unit test snapshots due to a dependency version change [#36435](https://github.com/woocommerce/woocommerce/pull/36435)
|
||||
* Fix - Fix variations exported as draft being imported as draft (and thus remaining invisible) [#36933](https://github.com/woocommerce/woocommerce/pull/36933)
|
||||
* Fix - Fix WP data resolution (`invalidateResolution`) not working with WP 5.9 in marketing page. [#37198](https://github.com/woocommerce/woocommerce/pull/37198)
|
||||
* Fix - Handle date arguments in OrderTableQuery correctly by adjusting their timezones before running. [#36650](https://github.com/woocommerce/woocommerce/pull/36650)
|
||||
* Fix - Load same stylesheets in the Site Editor as in the frontend [#36911](https://github.com/woocommerce/woocommerce/pull/36911)
|
||||
* Fix - Loco Translate and wp-cli compatibility for woocommerce-admin translation files [#36739](https://github.com/woocommerce/woocommerce/pull/36739)
|
||||
* Fix - Override react version to 17.0.2 [#37087](https://github.com/woocommerce/woocommerce/pull/37087)
|
||||
* Fix - Prevent possible warning arising from use of woocommerce_wp_* family of functions. [#37026](https://github.com/woocommerce/woocommerce/pull/37026)
|
||||
* Fix - Record values for toggled checkboxes/features in settings [#37242](https://github.com/woocommerce/woocommerce/pull/37242)
|
||||
* Fix - Restore the sort order when orders are cached. [#36650](https://github.com/woocommerce/woocommerce/pull/36650)
|
||||
* Fix - Treat order as separate resource when validating for webhook since it's not necessarily a CPT anymore. [#36650](https://github.com/woocommerce/woocommerce/pull/36650)
|
||||
* Fix - Update Customers report with latest user data after editing user. [#37237](https://github.com/woocommerce/woocommerce/pull/37237)
|
||||
* Add - Add "Create a new campaign" modal in Campaigns card in Multichannel Marketing page. [#37044](https://github.com/woocommerce/woocommerce/pull/37044)
|
||||
* Add - Add a cache for orders, to use when custom order tables are enabled [#35014](https://github.com/woocommerce/woocommerce/pull/35014)
|
||||
* Add - Add an encoding selector to the product importer [#36819](https://github.com/woocommerce/woocommerce/pull/36819)
|
||||
* Add - Add Campaigns card into Multichannel Marketing page. [#36735](https://github.com/woocommerce/woocommerce/pull/36735)
|
||||
* Add - Added images support for the payment recommendations transaction processors [#37230](https://github.com/woocommerce/woocommerce/pull/37230)
|
||||
* Add - Added `woocommerce_widget_layered_nav_filters_start/end` hooks around layered nav filters widget [#36705](https://github.com/woocommerce/woocommerce/pull/36705)
|
||||
* Add - Add introduction banner to multichannel marketing page. [#37110](https://github.com/woocommerce/woocommerce/pull/37110)
|
||||
* Add - Add marketplace suggestions and multichannel marketing information to WC Tracker. [#37017](https://github.com/woocommerce/woocommerce/pull/37017)
|
||||
* Add - Add new feature flag for the product edit blocks experience [#37137](https://github.com/woocommerce/woocommerce/pull/37137)
|
||||
* Add - Add productBlockEditorSettings script to be used for the Product Block Editor. [#37123](https://github.com/woocommerce/woocommerce/pull/37123)
|
||||
* Add - Add support for new countries in WCPay [#36906](https://github.com/woocommerce/woocommerce/pull/36906)
|
||||
* Add - Add wp-json/wc-admin/shipping-partner-suggestions API endpoint [#37155](https://github.com/woocommerce/woocommerce/pull/37155)
|
||||
* Add - Allow sorting by menu_order in products widget. [#37002](https://github.com/woocommerce/woocommerce/pull/37002)
|
||||
* Add - Create editor skeleton on add/edit product pages [#37023](https://github.com/woocommerce/woocommerce/pull/37023)
|
||||
* Add - Creating product entity in auto-draft status, and adding support for retrieving preexisting products. [#37064](https://github.com/woocommerce/woocommerce/pull/37064)
|
||||
* Add - Fixed image array in edit context for product/variations endpoint. [#28498](https://github.com/woocommerce/woocommerce/pull/28498)
|
||||
* Add - Initial e2e tests for new product editor. [#36902](https://github.com/woocommerce/woocommerce/pull/36902)
|
||||
* Add - Log to order notes when coupons are removed or applied. [#30642](https://github.com/woocommerce/woocommerce/pull/30642)
|
||||
* Add - Make WC_Order::get_tax_location accessible publicly through a wrapper function. [#36953](https://github.com/woocommerce/woocommerce/pull/36953)
|
||||
* Add - Update product post rest config when block editor feature is enabled. [#37206](https://github.com/woocommerce/woocommerce/pull/37206)
|
||||
* Update - Update WooCommerce Blocks to 9.8.4 [#37492](https://github.com/woocommerce/woocommerce/pull/37492)
|
||||
* Update - Update WooCommerce Blocks to 9.8.3 [#37477](https://github.com/woocommerce/woocommerce/pull/37477)
|
||||
* Update - Update WooCommerce Blocks to 9.8.2 [#37373](https://github.com/woocommerce/woocommerce/pull/37373)
|
||||
* Update - Add tabs and sections placeholders in product blocks template [#37174](https://github.com/woocommerce/woocommerce/pull/37174)
|
||||
* Update - Change the default date used on Revenue and Orders report to 'date_paid' and create spotlight on both reports [#36653](https://github.com/woocommerce/woocommerce/pull/36653)
|
||||
* Update - Change Variations form shown in Variations tab when there are no variations created [#36957](https://github.com/woocommerce/woocommerce/pull/36957)
|
||||
* Update - Moving currencyContext to relevant package, and updating all references. [#36959](https://github.com/woocommerce/woocommerce/pull/36959)
|
||||
* Update - Moving some components out of core and into product-editor package. [#36945](https://github.com/woocommerce/woocommerce/pull/36945)
|
||||
* Update - Moving use-product-helper and related product hooks to product editor package. [#37006](https://github.com/woocommerce/woocommerce/pull/37006)
|
||||
* Update - Refresh data source poller transients on wc_admin_daily [#37027](https://github.com/woocommerce/woocommerce/pull/37027)
|
||||
* Update - Remove accordion from "Other payment providers" in payment task [#37205](https://github.com/woocommerce/woocommerce/pull/37205)
|
||||
* Update - Remove Cart2Cart option from add product task [#37285](https://github.com/woocommerce/woocommerce/pull/37285)
|
||||
* Update - Show link to store settings when stock management is disabled. [#37140](https://github.com/woocommerce/woocommerce/pull/37140)
|
||||
* Update - Update create-wc-extension script within woocommerce-admin. [#36917](https://github.com/woocommerce/woocommerce/pull/36917)
|
||||
* Update - Update imports of product slot fills to new @woocommerce/product-editor library [#36830](https://github.com/woocommerce/woocommerce/pull/36830)
|
||||
* Update - Update obw payment gateways [#37233](https://github.com/woocommerce/woocommerce/pull/37233)
|
||||
* Update - Update playwright api-core-tests to associate orders with real products to prevent extension issues for those that validate product ids [#37243](https://github.com/woocommerce/woocommerce/pull/37243)
|
||||
* Update - Update playwright api-core-tests to handle cases where extensions add to shipping methods [#37239](https://github.com/woocommerce/woocommerce/pull/37239)
|
||||
* Update - Update product template by adding the list price and sale price blocks. [#37211](https://github.com/woocommerce/woocommerce/pull/37211)
|
||||
* Update - Updates automated release testing workflow to use Playwright [#36598](https://github.com/woocommerce/woocommerce/pull/36598)
|
||||
* Update - Update template of product type to include product name block. [#37132](https://github.com/woocommerce/woocommerce/pull/37132)
|
||||
* Update - Update the date modified field for an order when a refund for it is successfully processed. [#37047](https://github.com/woocommerce/woocommerce/pull/37047)
|
||||
* Update - Update WooCommerce BLocks to 9.8.0 [#37210](https://github.com/woocommerce/woocommerce/pull/37210)
|
||||
* Update - Update WooCommerce Blocks to 9.8.1 [#37238](https://github.com/woocommerce/woocommerce/pull/37238)
|
||||
* Update - Updating rest namespace for product posttype to version 3. [#37028](https://github.com/woocommerce/woocommerce/pull/37028)
|
||||
* Update - Use the currently activated theme color for completed tasks strikethough [#37001](https://github.com/woocommerce/woocommerce/pull/37001)
|
||||
* Dev - Add @woocommerce/admin-layout package. [#37094](https://github.com/woocommerce/woocommerce/pull/37094)
|
||||
* Dev - Add CES data store to @woocommerce/customer-effort-score [#37252](https://github.com/woocommerce/woocommerce/pull/37252)
|
||||
* Dev - Add existing global attribute layout #36944 [#36944](https://github.com/woocommerce/woocommerce/pull/36944)
|
||||
* Dev - Add missing woocommerce_run_on_woocommerce_admin_updated hook for the scheduled action registered in RemoteInboxNotificationsEngine [#36768](https://github.com/woocommerce/woocommerce/pull/36768)
|
||||
* Dev - add wpLogin import to wc-baseline-load.js [#36940](https://github.com/woocommerce/woocommerce/pull/36940)
|
||||
* Dev - Convert "Allow backorders?" into radio buttons [#37282](https://github.com/woocommerce/woocommerce/pull/37282)
|
||||
* Dev - Fix lint issues [#36988](https://github.com/woocommerce/woocommerce/pull/36988)
|
||||
* Dev - Fix the value of `UPDATE_WC` environment variable in the daily k6 performance tests. [#37049](https://github.com/woocommerce/woocommerce/pull/37049)
|
||||
* Dev - Move CES components and utilities to @woocommerce/customer-effort-score [#37112](https://github.com/woocommerce/woocommerce/pull/37112)
|
||||
* Dev - Move hook to confirm unsaved form changes to navigation package [#36752](https://github.com/woocommerce/woocommerce/pull/36752)
|
||||
* Dev - Move product utils into product editor package [#36730](https://github.com/woocommerce/woocommerce/pull/36730)
|
||||
* Dev - Set up React Fast Refresh in woocommerce-admin [#37165](https://github.com/woocommerce/woocommerce/pull/37165)
|
||||
* Dev - Show "Stock status" as a collection of radio buttons [#37278](https://github.com/woocommerce/woocommerce/pull/37278)
|
||||
* Dev - Show a message for variable products [#37185](https://github.com/woocommerce/woocommerce/pull/37185)
|
||||
* Dev - Support E2E testing of draft releases. [#36997](https://github.com/woocommerce/woocommerce/pull/36997)
|
||||
* Dev - Sync @wordpress package versions via syncpack. [#37034](https://github.com/woocommerce/woocommerce/pull/37034)
|
||||
* Tweak - Add productId dependency when getting the product by id in ProductPage [#37152](https://github.com/woocommerce/woocommerce/pull/37152)
|
||||
* Tweak - Add tracking for local pickup method in Checkout [#36847](https://github.com/woocommerce/woocommerce/pull/36847)
|
||||
* Tweak - Add Tracks events for product inventory tab interactions. [#37202](https://github.com/woocommerce/woocommerce/pull/37202)
|
||||
* Tweak - Change Avalara CTA copy in tax task to Download [#37224](https://github.com/woocommerce/woocommerce/pull/37224)
|
||||
* Tweak - Make sure 'safe_text' settings are rendered as 'text' inputs for compatibility. [#37154](https://github.com/woocommerce/woocommerce/pull/37154)
|
||||
* Tweak - Prevent 'woocommerce_ajax_order_items_removed' from generating PHP warnings. [#37178](https://github.com/woocommerce/woocommerce/pull/37178)
|
||||
* Tweak - Rename "Manage stock?" label to "Stock management". [#37135](https://github.com/woocommerce/woocommerce/pull/37135)
|
||||
* Tweak - Trigger event `woocommerce_attributes_saved` following successful product meta box ajax update. [#36943](https://github.com/woocommerce/woocommerce/pull/36943)
|
||||
* Tweak - Visual tweaks for shipping partner banners [#37229](https://github.com/woocommerce/woocommerce/pull/37229)
|
||||
* Performance - Bypass Action Scheduler for customer updates. [#37265](https://github.com/woocommerce/woocommerce/pull/37265)
|
||||
* Performance - Switch wc_product_attributes_lookup table management to use truncate and dbDelta over drop table [#36872](https://github.com/woocommerce/woocommerce/pull/36872)
|
||||
* Enhancement - Add 'display_context' argument to wc_get_price_to_display(). [#25080](https://github.com/woocommerce/woocommerce/pull/25080)
|
||||
* Enhancement - Added woocommerce_reduce_order_item_stock action hook [#34721](https://github.com/woocommerce/woocommerce/pull/34721)
|
||||
* Enhancement - Add the support for the C&C Blocks in declaring compatibility feature [#36426](https://github.com/woocommerce/woocommerce/pull/36426)
|
||||
|
||||
|
||||
= 7.5.1 2023-03-21 =
|
||||
|
||||
**WooCommerce**
|
||||
|
||||
* Fix - Fix no enforcing of min/max limits in quantity selector of variable products. [#36871](https://github.com/woocommerce/woocommerce/pull/36871)
|
||||
* Dev - Update column definitions with synonymous types to prevent dbDelta from trying to ALTER them on each install. [#37277](https://github.com/woocommerce/woocommerce/pull/37277)
|
||||
* Update - Update WooCommerce Blocks to 9.6.6. [#37298](https://github.com/woocommerce/woocommerce/pull/37298)
|
||||
|
||||
= 7.5.0 2023-03-14 =
|
||||
|
||||
**WooCommerce**
|
||||
|
||||
* Fix - Add HPOS support to the reserved stock query [#36535](https://github.com/woocommerce/woocommerce/pull/36535)
|
||||
* Fix - Comment: Fix inconsistencies on Analytics > Orders table when using date_paid or date_completed [#36876](https://github.com/woocommerce/woocommerce/pull/36876)
|
||||
* Fix - Define a public `api` property in the WooCommerce class to prevent a PHP deprecation warning [#36545](https://github.com/woocommerce/woocommerce/pull/36545)
|
||||
* Fix - Don't delete order from posts table when deleted from orders table if the later is authoritative and sync is off [#36617](https://github.com/woocommerce/woocommerce/pull/36617)
|
||||
* Fix - Eliminate data store internal meta keys duplicates [#36611](https://github.com/woocommerce/woocommerce/pull/36611)
|
||||
* Fix - Ensure changes made via the `woocommerce_order_list_table_prepare_items_query_args` are observed. [#36649](https://github.com/woocommerce/woocommerce/pull/36649)
|
||||
* Fix - Ensuring that we know if allowTracking is true before adding exit page. [#36656](https://github.com/woocommerce/woocommerce/pull/36656)
|
||||
* Fix - Fix Ampersand changed to & on product attribute export [#36525](https://github.com/woocommerce/woocommerce/pull/36525)
|
||||
* Fix - Fix decimal points for NOK currency [#36780](https://github.com/woocommerce/woocommerce/pull/36780)
|
||||
* Fix - Fix inconsitent product task icon colors [#36889](https://github.com/woocommerce/woocommerce/pull/36889)
|
||||
* Fix - Fix WordPress unit tests libraries being installed in a symlinked folder structure [#36641](https://github.com/woocommerce/woocommerce/pull/36641)
|
||||
* Fix - Make states optional for Hungary and Bulgaria. [#36701](https://github.com/woocommerce/woocommerce/pull/36701)
|
||||
* Fix - Screen ID matching switched to untranslated 'woocommerce' strings. [#36854](https://github.com/woocommerce/woocommerce/pull/36854)
|
||||
* Fix - Translate the labels for units of measure. [#36708](https://github.com/woocommerce/woocommerce/pull/36708)
|
||||
* Fix - Update `config@3.3.7` (from `3.3.3`). Fix `node_env_var_name is not defined` error. [#33828](https://github.com/woocommerce/woocommerce/pull/33828)
|
||||
* Add - Add 'add_tab' method in FormFactory to allow plugins to extend the WooCommerce admin product form [#36583](https://github.com/woocommerce/woocommerce/pull/36583)
|
||||
* Add - Add @woocommerce/product-editor dependency and change dependency of ProductSectionLayout component. [#36600](https://github.com/woocommerce/woocommerce/pull/36600)
|
||||
* Add - Add additional global attributes and local attributes information when saving product attributes [#36858](https://github.com/woocommerce/woocommerce/pull/36858)
|
||||
* Add - Add a new Channels card in multichannel marketing page. [#36541](https://github.com/woocommerce/woocommerce/pull/36541)
|
||||
* Add - Add an experimental slot for marketing overview extensibility [#36828](https://github.com/woocommerce/woocommerce/pull/36828)
|
||||
* Add - Add slot fill support for tabs for the new product management MVP. [#36551](https://github.com/woocommerce/woocommerce/pull/36551)
|
||||
* Add - Add survey after disabling new experience [#36544](https://github.com/woocommerce/woocommerce/pull/36544)
|
||||
* Add - Add unique sku option to error data when setting product sku [#36612](https://github.com/woocommerce/woocommerce/pull/36612)
|
||||
* Add - Add WC-specific criteria to the Site Health test for persistent object caches [#35202](https://github.com/woocommerce/woocommerce/pull/35202)
|
||||
* Add - Enable new experience when new user selects "Physical product". [#36406](https://github.com/woocommerce/woocommerce/pull/36406)
|
||||
* Update - Update WooCommerce Blocks to 9.6.5 [#37051](https://github.com/woocommerce/woocommerce/pull/37051)
|
||||
* Update - Update WooCommerce Blocks to 9.6.3 [#36992](https://github.com/woocommerce/woocommerce/pull/36992)
|
||||
* Update - Update WooCommerce Blocks to 9.6.2 [#36919](https://github.com/woocommerce/woocommerce/pull/36919)
|
||||
* Update - Add date_paid and date_completed date sorting options for Revenue and Order reports [#36492](https://github.com/woocommerce/woocommerce/pull/36492)
|
||||
* Update - Add default value for backorders [#36607](https://github.com/woocommerce/woocommerce/pull/36607)
|
||||
* Update - Add Skydropx, Envia, Sendcloud, Packlink to shipping task [#36873](https://github.com/woocommerce/woocommerce/pull/36873)
|
||||
* Update - Always show comments for product feedback form [#36484](https://github.com/woocommerce/woocommerce/pull/36484)
|
||||
* Update - Delete FlexSlider code for legacy browsers. [#36690](https://github.com/woocommerce/woocommerce/pull/36690)
|
||||
* Update - Disable the new product editor, pending design updates. [#36894](https://github.com/woocommerce/woocommerce/pull/36894)
|
||||
* Update - Have "Grow your store" appear first in marketing task by default [#36826](https://github.com/woocommerce/woocommerce/pull/36826)
|
||||
* Update - Migrating product editor pricing section to slot fills. [#36500](https://github.com/woocommerce/woocommerce/pull/36500)
|
||||
* Update - Refactor slot fills to ensure variant fills have distinct slots. [#36646](https://github.com/woocommerce/woocommerce/pull/36646)
|
||||
* Update - Removed I.D column from product import samples [#36857](https://github.com/woocommerce/woocommerce/pull/36857)
|
||||
* Update - Remove Meta from grow your store list [#36886](https://github.com/woocommerce/woocommerce/pull/36886)
|
||||
* Update - Remove opinionated styles from buttons in block themes so they inherit theme styles more accurately [#36651](https://github.com/woocommerce/woocommerce/pull/36651)
|
||||
* Update - Replace $.ajax() calls with browser-native window.fetch() calls. [#36275](https://github.com/woocommerce/woocommerce/pull/36275)
|
||||
* Update - Update payment gateway list ordering priority and remove Klarna from North America [#36550](https://github.com/woocommerce/woocommerce/pull/36550)
|
||||
* Update - Update Playwright version from 1.28.0 -> 1.30.0 [#36789](https://github.com/woocommerce/woocommerce/pull/36789)
|
||||
* Update - Updates to product editor fill to support new prop API. [#36592](https://github.com/woocommerce/woocommerce/pull/36592)
|
||||
* Update - Update WooCommerce Blocks 9.6.0 & 9.6.1 [#36852](https://github.com/woocommerce/woocommerce/pull/36852)
|
||||
* Dev - Add attribute creation form when there are no attributes [#36606](https://github.com/woocommerce/woocommerce/pull/36606)
|
||||
* Dev - Add a unit test for woocommerce_admin_experimental_onboarding_tasklists filter [#36827](https://github.com/woocommerce/woocommerce/pull/36827)
|
||||
* Dev - Code refactor on marketing components. [#36540](https://github.com/woocommerce/woocommerce/pull/36540)
|
||||
* Dev - Made e2e selectors more robust [#36499](https://github.com/woocommerce/woocommerce/pull/36499)
|
||||
* Dev - Remove attribute type logic from attribute component [#36563](https://github.com/woocommerce/woocommerce/pull/36563)
|
||||
* Dev - Update eslint to 8.32.0 across the monorepo. [#36700](https://github.com/woocommerce/woocommerce/pull/36700)
|
||||
* Dev - Update pnpm command to run e2e tests for consistency. Also update docs with new command. [#35287](https://github.com/woocommerce/woocommerce/pull/35287)
|
||||
* Tweak - Add IR and fields priorities to list of get_country_locale() method to follow conventional way of addressing in Iran. [#36491](https://github.com/woocommerce/woocommerce/pull/36491)
|
||||
* Tweak - Add missing deprecation notice for filter hook woocommerce_my_account_my_orders_columns. [#36356](https://github.com/woocommerce/woocommerce/pull/36356)
|
||||
* Tweak - Adjust default sizes for the quantity and coupon input fields within the cart page. [#29122](https://github.com/woocommerce/woocommerce/pull/29122)
|
||||
* Tweak - Do not display low/out-of-stock information in the dashboard status widget when stock management is disabled. [#36703](https://github.com/woocommerce/woocommerce/pull/36703)
|
||||
* Tweak - Remove free trial terms from Avalara tax task [#36888](https://github.com/woocommerce/woocommerce/pull/36888)
|
||||
* Tweak - Tweak product link description and display in the new product management experience [#36591](https://github.com/woocommerce/woocommerce/pull/36591)
|
||||
* Enhancement - Change the sass variable names to more predictable ones. [#28908](https://github.com/woocommerce/woocommerce/pull/28908)
|
||||
|
||||
|
||||
= 7.4.1 2023-03-01 =
|
||||
|
||||
**WooCommerce**
|
||||
|
@ -225,7 +991,7 @@
|
|||
* Tweak - Resolve an error in the product tracking code by testing to see if the `post_type` query var is set before checking its value. [#34501](https://github.com/woocommerce/woocommerce/pull/34501)
|
||||
* Tweak - Simplify wording within the customer emails for on-hold orders. [#31886](https://github.com/woocommerce/woocommerce/pull/31886)
|
||||
* Tweak - WooCommerce has now been tested up to WordPress 6.1.x. [#35985](https://github.com/woocommerce/woocommerce/pull/35985)
|
||||
* Performance - Split CALC_FOUND_ROW query into seperate count query for better performance. [#35468](https://github.com/woocommerce/woocommerce/pull/35468)
|
||||
* Performance - Split CALC_FOUND_ROW query into separate count query for better performance. [#35468](https://github.com/woocommerce/woocommerce/pull/35468)
|
||||
* Enhancement - Add a bottom padding to the whole form [#35721](https://github.com/woocommerce/woocommerce/pull/35721)
|
||||
* Enhancement - Add a confirmation modal when the user tries to navigate away with unsaved changes [#35625](https://github.com/woocommerce/woocommerce/pull/35625)
|
||||
* Enhancement - Add a default placeholder title for newly added attributes and always show remove button for attributes [#35904](https://github.com/woocommerce/woocommerce/pull/35904)
|
||||
|
@ -561,7 +1327,7 @@
|
|||
* Update - Update WooCommerce Blocks to 8.7.5 [#35428](https://github.com/woocommerce/woocommerce/pull/35428)
|
||||
* Update - Improve the warnings about incompatibilities between plugins and features [#35198](https://github.com/woocommerce/woocommerce/pull/35198)
|
||||
* Update - Additional payment methods on new WCPay promotion page (payment-welcome) [#34581](https://github.com/woocommerce/woocommerce/pull/34581)
|
||||
* Update - Add Tiktok to free grow extensions list [#34953](https://github.com/woocommerce/woocommerce/pull/34953)
|
||||
* Update - Add TikTok to free grow extensions list [#34953](https://github.com/woocommerce/woocommerce/pull/34953)
|
||||
* Update - Allowing generic item type in new experimental SelectControl. [#34547](https://github.com/woocommerce/woocommerce/pull/34547)
|
||||
* Update - Change order data store internal key to props for better representation. [#34627](https://github.com/woocommerce/woocommerce/pull/34627)
|
||||
* Update - Changing inbox display to only 5 notes with the ability to load more. [#35003](https://github.com/woocommerce/woocommerce/pull/35003)
|
||||
|
@ -3164,7 +3930,7 @@
|
|||
* Fix - Add protection around func_get_args_call for backwards compatibility. #28677
|
||||
* Fix - Restore stock_status in REST API V3 response. #28731
|
||||
* Fix - Revert some of the changes related to perf enhancements (27735) as it was breaking stock_status filter. #28745
|
||||
* Dev - Hook for intializing price slider in frontend. #28014
|
||||
* Dev - Hook for initializing price slider in frontend. #28014
|
||||
* Dev - Add support for running a custom initialization script for tests. #28041
|
||||
* Dev - Use the coenjacobs/mozart package to renamespace vendor packages. #28147
|
||||
* Dev - Documentation for `wc_get_container`. #28269
|
||||
|
@ -5083,7 +5849,7 @@
|
|||
* Fix - Fix edge case where `get_plugins` would not have the custom WooCommerce plugin headers if `get_plugins` was called early. #21669
|
||||
* Fix - Prevent PHP warning when deprecated user meta starts with uppercase. #21943
|
||||
* Fix - Fixed support for multiple query parameters translated to meta queries via REST API requests. #22108
|
||||
* Fix - Prevent PHP errors when trying to access non-existant report tabs. #22183
|
||||
* Fix - Prevent PHP errors when trying to access non-existent report tabs. #22183
|
||||
* Fix - Filter by attributes dropdown placeholder text should not be wrapped in quotes. #22185
|
||||
* Fix - Apply sale price until end of closing sale date. #22189
|
||||
* Fix - Allow empty schema again when registering a custom field for the API. #22204
|
||||
|
@ -6405,7 +7171,7 @@
|
|||
* Removed internal scroll from log viewer.
|
||||
* Add reply-to to admin emails.
|
||||
* Improved the zone setup flow.
|
||||
* Made wc_get_wildcard_postcodes return the orignal postcode plus * since wildcards should match empty strings too.
|
||||
* Made wc_get_wildcard_postcodes return the original postcode plus * since wildcards should match empty strings too.
|
||||
* Use all paid statuses in $customer->get_total_spent().
|
||||
* Move location of billing email field to work with password managers.
|
||||
* Option to restrict selling locations by country.
|
||||
|
@ -7915,7 +8681,7 @@
|
|||
* Tweak - Flat rate shipping support for percentage factor of additional costs.
|
||||
* Tweak - local delivery _ pattern matching for postcodes. e.g. NG1___ would match NG1 1AA but not NG10 1AA.
|
||||
* Tweak - Improved layered nav OR count logic
|
||||
* Tweak - Make shipping methods check if taxable, so when customer is VAT excempt taxes are not included in price.
|
||||
* Tweak - Make shipping methods check if taxable, so when customer is VAT exempt taxes are not included in price.
|
||||
* Tweak - Coupon in admin bar new menu #3974
|
||||
* Tweak - Shortcode tag filters + updated menu names to make white labelling easier.
|
||||
* Tweak - Removed placeholder polyfill. Use this plugin to replace functionality if required: https://wordpress.org/plugins/html5-placeholder-polyfill/
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Fix the incorrect workflow input for uploading Allure reports.
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Update locator to reduce flakiness when running tests against a JN site
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: add
|
||||
|
||||
Added `woocommerce_widget_layered_nav_filters_start/end` hooks around layered nav filters widget
|
|
@ -0,0 +1,90 @@
|
|||
# WooCommerce Developer Documentation
|
||||
|
||||
> ⚠️ **Notice:** This documentation is currently a **work in progress**. While it's open to the public for transparency and collaboration, please be aware that some sections might be incomplete or subject to change. We appreciate your patience and welcome any contributions!
|
||||
|
||||
This is your go-to place to find everything you need to know to get started with WooCommerce development, including implementation details for specific parts of the WooCommerce code base.
|
||||
|
||||
## Getting started
|
||||
|
||||
WooCommerce is a customizable, open-source eCommerce platform built on WordPress. It empowers businesses worldwide to sell anything from physical products and digital downloads to subscriptions, content, and even appointments.
|
||||
|
||||
Get familiar with [WordPress Plugin Development](https://developer.wordpress.org/plugins/).
|
||||
|
||||
Take a moment to familiarize yourself with our [Developer Resources](https://developer.wordpress.org/plugins/plugin-basics/).
|
||||
|
||||
Once you're ready to move forward, consider one of the following:
|
||||
|
||||
- [Tools for low code development](getting-started/tools-for-low-code-development.md)
|
||||
- [Building your first extension](extension-development/building-your-first-extension.md)
|
||||
- [How to design a simple extension](extension-development/how-to-design-a-simple-extension.md)
|
||||
|
||||
## Contributions
|
||||
|
||||
The WooCommerce ecosystem thrives on community contributions. Whether it's improving documentation, reporting bugs, or contributing code, we greatly appreciate every contribution from our community.
|
||||
|
||||
- To contribute to **the core WooCommerce project**, check out our [Contributing guide](https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md).
|
||||
- To contribute to **documentation** please refer to the [documentation style guide](style-guide.md).
|
||||
|
||||
## Support
|
||||
|
||||
- To request a **new document, correction, or improvement**, [create an issue](https://github.com/woocommerce/woodocs/issues/new/choose).
|
||||
- For development help, start with the [WooCommerce Community Forum](https://wordpress.org/support/plugin/woocommerce/), to see if someone else has already asked the same question. You can also pose your question in the `#developers` channel of our [Community Slack](https://woocommerce.com/community-slack/). If you're not sure where to ask your question, you can always [contact us](https://woocommerce.com/contact-us/), and our Happiness Engineers will be glad to point you in the right direction.
|
||||
- For additional support with customizations, you might consider hiring from [WooExperts](https://woocommerce.com/experts/) or [Codeable](https://codeable.io/).
|
||||
|
||||
### Additional Resources
|
||||
|
||||
- [WooCommerce Official Website](https://woocommerce.com/)
|
||||
- [Woo Marketplace](https://woocommerce.com/marketplace)
|
||||
- All [WooCommerce Repositories on GitHub](https://woocommerce.github.io/)
|
||||
|
||||
### Other documentation
|
||||
|
||||
Some directories contain documentation about their own contents, in the form of README file. The available files are listed below, **if you create a new README file please add it to the corresponding list.**
|
||||
|
||||
Available READMe files for the WooCommerce plugin:
|
||||
|
||||
- [`Root README`](../plugins/woocommerce/README.md)
|
||||
- [`i18n/languages`](../plugins/woocommerce/i18n/languages/README.md)
|
||||
- [`includes`](../plugins/woocommerce/includes/README.md)
|
||||
- [`lib`](../plugins/woocommerce/lib/README.md)
|
||||
- [`packages`](../plugins/woocommerce/packages/README.md)
|
||||
- [`src`](../plugins/woocommerce/src/README.md)
|
||||
- [`src/Admin/RemoteInboxNotifications`](../plugins/woocommerce/src/Admin/RemoteInboxNotifications/README.md)
|
||||
- [`src/Admin/RemoteInboxNotifications/Transformers`](../plugins/woocommerce/src/Admin/RemoteInboxNotifications/Transformers/README.md)
|
||||
- [`src/Blocks`](../plugins/woocommerce/src/Blocks/README.md)
|
||||
- [`src/Internal`](../plugins/woocommerce/src/Internal/README.md)
|
||||
- [`src/Internal/Admin/ProductForm`](../plugins/woocommerce/src/Internal/Admin/ProductForm/README.md)
|
||||
- [`tests`](../plugins/woocommerce/tests/README.md)
|
||||
- [`tests/api-core-tests`](../plugins/woocommerce/tests/api-core-tests/README.md)
|
||||
- [`tests/e2e`](../plugins/woocommerce/tests/e2e/README.md)
|
||||
- [`tests/e2e-pw`](../plugins/woocommerce/tests/e2e-pw/README.md)
|
||||
- [`tests/performance`](../plugins/woocommerce/tests/performance/README.md)
|
||||
- [`tests/Tools/CodeHacking`](../plugins/woocommerce/tests/Tools/CodeHacking/README.md)
|
||||
|
||||
Available READMe files for the WooCommerce Admin plugin:
|
||||
|
||||
- [`Root README`](../plugins/woocommerce-admin/README.md)
|
||||
- [`client/activity-panel`](../plugins/woocommerce-admin/client/activity-panel/README.md)
|
||||
- [`client/activity-panel/activity-card`](../plugins/woocommerce-admin/client/activity-panel/activity-card/README.md)
|
||||
- [`client/activity-panel/activity-header`](../plugins/woocommerce-admin/client/activity-panel/activity-header/README.md)
|
||||
- [`client/analytics/report`](../plugins/woocommerce-admin/client/analytics/report/README.md)
|
||||
- [`client/analytics/settings`](../plugins/woocommerce-admin/client/analytics/settings/README.md)
|
||||
- [`client/dashboard`](../plugins/woocommerce-admin/client/dashboard/README.md)
|
||||
- [`client/header`](../plugins/woocommerce-admin/client/header/README.md)
|
||||
- [`client/marketing`](../plugins/woocommerce-admin/client/marketing/README.md)
|
||||
- [`client/marketing/components/button`](../plugins/woocommerce-admin/client/marketing/components/button/README.md)
|
||||
- [`client/marketing/components/card`](../plugins/woocommerce-admin/client/marketing/components/card/README.md)
|
||||
- [`client/marketing/components/product-icon`](../plugins/woocommerce-admin/client/marketing/components/product-icon/README.md)
|
||||
- [`client/utils`](../plugins/woocommerce-admin/client/utils/README.md)
|
||||
- [`client/wp-admin-scripts`](../plugins/woocommerce-admin/client/wp-admin-scripts/README.md)
|
||||
- [`docs`](../plugins/woocommerce-admin/docs/README.md)
|
||||
- [`docs/examples`](../plugins/woocommerce-admin/docs/examples/README.md)
|
||||
- [`docs/examples/extensions`](../plugins/woocommerce-admin/docs/examples/extensions/README.md)
|
||||
- [`docs/features`](../plugins/woocommerce-admin/docs/features/README.md)
|
||||
- [`docs/woocommerce.com`](../plugins/woocommerce-admin/docs/woocommerce.com/README.md)
|
||||
|
||||
Available READMe files for the WooCommerce Beta Tested plugin:
|
||||
|
||||
- [`Root README`](../plugins/woocommerce-beta-tester/README.md)
|
||||
- [`src/tools`](../plugins/woocommerce-beta-tester/src/tools/README.md)
|
||||
- [`userscripts`](../plugins/woocommerce-beta-tester/userscripts/README.md)
|
|
@ -0,0 +1,13 @@
|
|||
# WooCommerce code snippets
|
||||
|
||||
Various code snippets you can add to your site to enable custom functionality:
|
||||
|
||||
- [Add a country](./add-a-country.md)
|
||||
- [Add a currency and symbol](./add-a-currency-symbol.md)
|
||||
- [Add a message above the login / register form](./before-login--register-form.md)
|
||||
- [Add or modify states](./add-or-modify-states.md)
|
||||
- [Adjust the quantity input values](./adjust-quantity-input-values.md)
|
||||
- [Change a currency symbol](./change-a-currency-symbol.md)
|
||||
- [Change number of related products output](./number-of-products-per-row.md)
|
||||
- [Rename a country](./rename-a-country.md)
|
||||
- [Unhook and remove WooCommerce emails](./unhook--remove-woocommerce-emails.md)
|
|
@ -0,0 +1,38 @@
|
|||
# Add a country
|
||||
|
||||
|
||||
Add this code to your child theme’s `functions.php` file or via a plugin that allows custom functions to be added, such as the [Code Snippets](https://wordpress.org/plugins/code-snippets/) plugin. Avoid adding custom code directly to your parent theme’s functions.php file, as this will be wiped entirely when you update the theme.
|
||||
|
||||
```php
|
||||
if ( ! function_exists( 'YOUR_PREFIX_add_country_to_countries_list' ) ) {
|
||||
/**
|
||||
* Add a country to countries list
|
||||
*
|
||||
* @param array $countries Existing country list.
|
||||
* @return array $countries Modified country list.
|
||||
*/
|
||||
function YOUR_PREFIX_add_country_to_countries_list( $countries ) {
|
||||
$new_countries = array(
|
||||
'NIRE' => __( 'Northern Ireland', 'YOUR-TEXTDOMAIN' ),
|
||||
);
|
||||
|
||||
return array_merge( $countries, $new_countries );
|
||||
}
|
||||
add_filter( 'woocommerce_countries', 'YOUR_PREFIX_add_country_to_countries_list' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'YOUR_PREFIX_add_country_to_continents_list' ) ) {
|
||||
/**
|
||||
* Add a country to continents list
|
||||
*
|
||||
* @param array $continents Existing continents list.
|
||||
* @return array $continents Modified continents list.
|
||||
*/
|
||||
function YOUR_PREFIX_add_country_to_continents_list( $continents ) {
|
||||
$continents['EU']['countries'][] = 'NIRE';
|
||||
|
||||
return $continents;
|
||||
}
|
||||
add_filter( 'woocommerce_continents', 'YOUR_PREFIX_add_country_to_continents_list' );
|
||||
}
|
||||
```
|
|
@ -0,0 +1,38 @@
|
|||
# Add a currency and symbol
|
||||
|
||||
Add this code to your child theme’s `functions.php` file or via a plugin that allows custom functions to be added, such as the [Code Snippets](https://wordpress.org/plugins/code-snippets/) plugin. Avoid adding custom code directly to your parent theme’s functions.php file, as this will be wiped entirely when you update the theme.
|
||||
|
||||
```php
|
||||
if ( ! function_exists( 'YOUR_PREFIX_add_currency_name' ) ) {
|
||||
/**
|
||||
* Add custom currency
|
||||
*
|
||||
* @param array $currencies Existing currencies.
|
||||
* @return array $currencies Updated currencies.
|
||||
*/
|
||||
function YOUR_PREFIX_add_currency_name( $currencies ) {
|
||||
$currencies['ABC'] = __( 'Currency name', 'YOUR-TEXTDOMAIN' );
|
||||
|
||||
return $currencies;
|
||||
}
|
||||
add_filter( 'woocommerce_currencies', 'YOUR_PREFIX_add_currency_name' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'YOUR_PREFIX_add_currency_symbol' ) ) {
|
||||
/**
|
||||
* Add custom currency symbol
|
||||
*
|
||||
* @param string $currency_symbol Existing currency symbols.
|
||||
* @param string $currency Currency code.
|
||||
* @return string $currency_symbol Updated currency symbol(s).
|
||||
*/
|
||||
function YOUR_PREFIX_add_currency_symbol( $currency_symbol, $currency ) {
|
||||
switch( $currency ) {
|
||||
case 'ABC': $currency_symbol = '$'; break;
|
||||
}
|
||||
|
||||
return $currency_symbol;
|
||||
}
|
||||
add_filter('woocommerce_currency_symbol', 'YOUR_PREFIX_add_currency_symbol', 10, 2);
|
||||
}
|
||||
```
|
|
@ -0,0 +1,27 @@
|
|||
# Add or modify states
|
||||
|
||||
Add this code to your child theme’s `functions.php` file or via a plugin that allows custom functions to be added, such as the [Code Snippets](https://wordpress.org/plugins/code-snippets/) plugin. Avoid adding custom code directly to your parent theme’s functions.php file, as this will be wiped entirely when you update the theme.
|
||||
|
||||
Add your own or modify shipping states in WooCommerce.
|
||||
|
||||
> Note: you **must** replace both instances of XX with your country code. This means each state id in the array must have your two letter country code before the number you assign to the state.
|
||||
|
||||
```php
|
||||
if ( ! function_exists( 'YOUR_PREFIX_add_or_modify_states' ) ) {
|
||||
/**
|
||||
* Add or modify States
|
||||
*
|
||||
* @param array $states Existing country states.
|
||||
* @return array $states Modified country states.
|
||||
*/
|
||||
function YOUR_PREFIX_add_or_modify_states( $states ) {
|
||||
$states['XX'] = array(
|
||||
'XX1' => __( 'State 1', 'YOUR-TEXTDOMAIN' ),
|
||||
'XX2' => __( 'State 2', 'YOUR-TEXTDOMAIN' ),
|
||||
);
|
||||
|
||||
return $states;
|
||||
}
|
||||
add_filter( 'woocommerce_states', 'YOUR_PREFIX_add_or_modify_states' );
|
||||
}
|
||||
```
|
|
@ -0,0 +1,49 @@
|
|||
# Adjust the quantity input values
|
||||
|
||||
> This is a **Developer level** doc. If you are unfamiliar with code and resolving potential conflicts, select a [WooExpert or Developer](https://woocommerce.com/customizations/) for assistance. We are unable to provide support for customizations under our [Support Policy](http://www.woocommerce.com/support-policy/).
|
||||
|
||||
Set the starting value, maximum value, minimum value, and increment amount for quantity input fields on product pages.
|
||||
|
||||
Add this code to your child theme’s `functions.php` file or via a plugin that allows custom functions to be added, such as the [Code snippets](https://wordpress.org/plugins/code-snippets/) plugin. Avoid adding custom code directly to your parent theme’s `functions.php` file, as this will be wiped entirely when you update the theme.
|
||||
|
||||
```php
|
||||
if ( ! function_exists( 'YOUR_PREFIX_woocommerce_quantity_input_args' ) ) {
|
||||
/**
|
||||
* Adjust the quantity input values for simple products
|
||||
*/
|
||||
function YOUR_PREFIX_woocommerce_quantity_input_args( $args, $product ) {
|
||||
// Only affect the starting value on product pages, not the cart
|
||||
if ( is_singular( 'product' ) ) {
|
||||
$args['input_value'] = 4;
|
||||
}
|
||||
|
||||
$args['max_value'] = 10; // Maximum value
|
||||
$args['min_value'] = 2; // Minimum value
|
||||
$args['step'] = 2; // Quantity steps
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
add_filter( 'woocommerce_quantity_input_args', 'YOUR_PREFIX_woocommerce_quantity_input_args', 10, 2 );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'YOUR_PREFIX_woocommerce_available_variation' ) ) {
|
||||
/**
|
||||
* Adjust the quantity input values for variations
|
||||
*/
|
||||
function YOUR_PREFIX_woocommerce_available_variation( $args ) {
|
||||
$args['max_qty'] = 20; // Maximum value (variations)
|
||||
$args['min_qty'] = 2; // Minimum value (variations)
|
||||
|
||||
// Note: the starting value and step for variations is controlled
|
||||
// from the 'woocommerce_quantity_input_args' filter shown above for
|
||||
// simple products
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
add_filter( 'woocommerce_available_variation', 'YOUR_PREFIX_woocommerce_available_variation' );
|
||||
}
|
||||
```
|
||||
|
||||
If you are looking for a little more power, check out our [Min/Max Quantities](http://woocommerce.com/products/minmax-quantities) extension!
|
|
@ -0,0 +1,34 @@
|
|||
# Add a message above the login / register form
|
||||
|
||||
> This is a **Developer level** doc. If you are unfamiliar with code and resolving potential conflicts, select a [WooExpert or Developer](https://woocommerce.com/customizations/) for assistance. We are unable to provide support for customizations under our [Support Policy](http://www.woocommerce.com/support-policy/).
|
||||
|
||||
This code will add a custom message above the login/register form on the user’s my-account page.
|
||||
|
||||
```php
|
||||
if ( ! function_exists( 'YOUR_PREFIX_login_message' ) ) {
|
||||
/**
|
||||
* Add a message above the login / register form on my-account page
|
||||
*/
|
||||
function YOUR_PREFIX_login_message() {
|
||||
if ( get_option( 'woocommerce_enable_myaccount_registration' ) == 'yes' ) {
|
||||
?>
|
||||
<div class="woocommerce-info">
|
||||
<p><?php _e( 'Returning customers login. New users register for next time so you can:', 'YOUR-TEXTDOMAIN' ); ?></p>
|
||||
<ul>
|
||||
<li><?php _e( 'View your order history', 'YOUR-TEXTDOMAIN' ); ?></li>
|
||||
<li><?php _e( 'Check on your orders', 'YOUR-TEXTDOMAIN' ); ?></li>
|
||||
<li><?php _e( 'Edit your addresses', 'YOUR-TEXTDOMAIN' ); ?></li>
|
||||
<li><?php _e( 'Change your password', 'YOUR-TEXTDOMAIN' ); ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action( 'woocommerce_before_customer_login_form', 'YOUR_PREFIX_login_message' );
|
||||
}
|
||||
```
|
||||
|
||||
Please note that for this code to work, the following options must be checked in the WooCommerce “Accounts & Privacy” settings:
|
||||
|
||||
- Allow customers to create an account during checkout.
|
||||
- Allow customers to create an account on the "My Account" page.
|
|
@ -0,0 +1,25 @@
|
|||
# Rename a country
|
||||
|
||||
See the [currency list](https://woocommerce.github.io/code-reference/files/woocommerce-includes-wc-core-functions.html#source-view.475) for reference on currency codes.
|
||||
|
||||
Add this code to your child theme’s `functions.php` file or via a plugin that allows custom functions to be added, such as the [Code Snippets](https://wordpress.org/plugins/code-snippets/) plugin. Avoid adding custom code directly to your parent theme’s functions.php file, as this will be wiped entirely when you update the theme.
|
||||
|
||||
```php
|
||||
if ( ! function_exists( 'YOUR_PREFIX_change_currency_symbol' ) ) {
|
||||
/**
|
||||
* Change a currency symbol
|
||||
*
|
||||
* @param string $currency_symbol Existing currency symbols.
|
||||
* @param string $currency Currency code.
|
||||
* @return string $currency_symbol Updated currency symbol(s).
|
||||
*/
|
||||
function YOUR_PREFIX_change_currency_symbol( $currency_symbol, $currency ) {
|
||||
switch ( $currency ) {
|
||||
case 'AUD': $currency_symbol = 'AUD$'; break;
|
||||
}
|
||||
|
||||
return $currency_symbol;
|
||||
}
|
||||
add_filter( 'woocommerce_currency_symbol', 'YOUR_PREFIX_change_currency_symbol', 10, 2 );
|
||||
}
|
||||
```
|
|
@ -0,0 +1,29 @@
|
|||
# Change number of related products output
|
||||
|
||||
> This is a **Developer level** doc. If you are unfamiliar with code and resolving potential conflicts, select a [WooExpert or Developer](https://woocommerce.com/customizations/) for assistance. We are unable to provide support for customizations under our [Support Policy](http://www.woocommerce.com/support-policy/?).
|
||||
|
||||
Add code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the [Code snippets](https://wordpress.org/plugins/code-snippets/) plugin. Avoid adding custom code directly to your parent theme’s `functions.php` file as this will be wiped entirely when you update the theme.
|
||||
|
||||
Please note that it does not work for all themes because of the way they’re coded.
|
||||
|
||||
```php
|
||||
if ( ! function_exists( 'YOUR_PREFIX_related_products_args' ) ) {
|
||||
/**
|
||||
* Change number of related products output.
|
||||
*
|
||||
* @param array $args The related products args.
|
||||
* @return array The modified related products args.
|
||||
*/
|
||||
function YOUR_PREFIX_related_products_args( $args ) {
|
||||
if ( ! is_array( $args ) ) {
|
||||
$args = array();
|
||||
}
|
||||
|
||||
$args['posts_per_page'] = 4; // 4 related products.
|
||||
$args['columns'] = 2; // Arranged in 2 columns.
|
||||
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
add_filter( 'woocommerce_output_related_products_args', 'YOUR_PREFIX_related_products_args', 20 );
|
||||
```
|
|
@ -0,0 +1,21 @@
|
|||
# Rename a country
|
||||
|
||||
|
||||
Add this code to your child theme’s `functions.php` file or via a plugin that allows custom functions to be added, such as the [Code Snippets](https://wordpress.org/plugins/code-snippets/) plugin. Avoid adding custom code directly to your parent theme’s functions.php file, as this will be wiped entirely when you update the theme.
|
||||
|
||||
```php
|
||||
if ( ! function_exists( 'YOUR_PREFIX_rename_country' ) ) {
|
||||
/**
|
||||
* Rename a country
|
||||
*
|
||||
* @param array $countries Existing country names
|
||||
* @return array $countries Updated country name(s)
|
||||
*/
|
||||
function YOUR_PREFIX_rename_country( $countries ) {
|
||||
$countries['IE'] = __( 'Ireland (Changed)', 'YOUR-TEXTDOMAIN' );
|
||||
|
||||
return $countries;
|
||||
}
|
||||
add_filter( 'woocommerce_countries', 'YOUR_PREFIX_rename_country' );
|
||||
}
|
||||
```
|
|
@ -0,0 +1,45 @@
|
|||
# Unhook and remove WooCommerce emails
|
||||
|
||||
> This is a **Developer level** doc. If you are unfamiliar with code and resolving potential conflicts, select a [WooExpert or Developer](https://woocommerce.com/customizations/) for assistance. We are unable to provide support for customizations under our [Support Policy](http://www.woocommerce.com/support-policy/).
|
||||
|
||||
This code allows you to unhook and remove the default WooCommerce emails.
|
||||
|
||||
Add this code to your child theme’s `functions.php` file or via a plugin that allows custom functions to be added, such as the [Code snippets](https://wordpress.org/plugins/code-snippets/) plugin. Avoid adding custom code directly to your parent theme’s `functions.php` file, as this will be wiped entirely when you update the theme.
|
||||
|
||||
```php
|
||||
if ( ! function_exists( 'YOUR_PREFIX_unhook_woocommerce_emails' ) ) {
|
||||
/**
|
||||
* Callback for woocommerce_email action hook
|
||||
*
|
||||
* @param WC_Email $email_class An Email class instance.
|
||||
* @return void
|
||||
*/
|
||||
function YOUR_PREFIX_unhook_woocommerce_emails( $email_class ) {
|
||||
/**
|
||||
* Hooks for sending emails during store events.
|
||||
*/
|
||||
remove_action( 'woocommerce_low_stock_notification', array( $email_class, 'low_stock' ) );
|
||||
remove_action( 'woocommerce_no_stock_notification', array( $email_class, 'no_stock' ) );
|
||||
remove_action( 'woocommerce_product_on_backorder_notification', array( $email_class, 'backorder' ) );
|
||||
|
||||
// New order emails.
|
||||
remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
|
||||
remove_action( 'woocommerce_order_status_pending_to_completed_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
|
||||
remove_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
|
||||
remove_action( 'woocommerce_order_status_failed_to_processing_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
|
||||
remove_action( 'woocommerce_order_status_failed_to_completed_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
|
||||
remove_action( 'woocommerce_order_status_failed_to_on-hold_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) );
|
||||
|
||||
// Processing order emails.
|
||||
remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) );
|
||||
remove_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $email_class->emails['WC_Email_Customer_On_Hold_Order'], 'trigger' ) );
|
||||
|
||||
// Completed order emails.
|
||||
remove_action( 'woocommerce_order_status_completed_notification', array( $email_class->emails['WC_Email_Customer_Completed_Order'], 'trigger' ) );
|
||||
|
||||
// Note emails.
|
||||
remove_action( 'woocommerce_new_customer_note_notification', array( $email_class->emails['WC_Email_Customer_Note'], 'trigger' ) );
|
||||
}
|
||||
}
|
||||
add_action( 'woocommerce_email', 'YOUR_PREFIX_unhook_woocommerce_emails' );
|
||||
```
|
|
@ -0,0 +1,211 @@
|
|||
# Developing using WooCommerce CRUD objects
|
||||
|
||||
CRUD is an abbreviation of the four basic operations you can do to a database or resource – Create, Read, Update, Delete.
|
||||
|
||||
[WooCommerce 3.0 introduced CRUD objects](https://woocommerce.wordpress.com/2016/10/27/the-new-crud-classes-in-woocommerce-2-7/) for working with WooCommerce data. **Whenever possible these objects should be used in your code instead of directly updating metadata or using WordPress post objects.**
|
||||
|
||||
Each of these objects contains a schema for the data it controls (properties), a getter and setter for each property, and a save/delete method which talks to a data store. The data store handles the actual saving/reading from the database. The object itself does not need to be aware of where the data is stored.
|
||||
|
||||
## The benefits of CRUD
|
||||
|
||||
* Structure – Each object has a pre-defined structure and keeps its own data valid.
|
||||
* Control – We control the flow of data, and any validation needed, so we know when changes occur.
|
||||
* Ease of development – As a developer, you don’t need to know the internals of the data you’re working with, just the names.
|
||||
* Abstraction – The data can be moved elsewhere, e.g. custom tables, without affecting existing code.
|
||||
* Unification – We can use the same code for updating things in admin as we do in the REST API and CLIs. Everything is unified.
|
||||
* Simplified code – Less procedural code to update objects which reduces likelihood of malfunction and adds more unit test coverage.
|
||||
|
||||
## CRUD object structure
|
||||
|
||||
The [`WC_Data`](https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/includes/abstracts/abstract-wc-data.php) class is the basic implementation for CRUD objects, and all CRUD objects extend it. The most important properties to note are `$data`, which is an array of props supported in each object, and `$id`, which is the object’s ID.
|
||||
|
||||
The [coupon object class](https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/includes/class-wc-coupon.php) is a good example of extending `WC_Data` and adding CRUD functions to all properties.
|
||||
|
||||
### Data
|
||||
|
||||
`$data` stores the property names, and default values:
|
||||
|
||||
```php
|
||||
/**
|
||||
* Data array, with defaults.
|
||||
* @since 3.0.0
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array(
|
||||
'code' => '',
|
||||
'amount' => 0,
|
||||
'date_created' => '',
|
||||
'date_modified' => '',
|
||||
'discount_type' => 'fixed_cart',
|
||||
'description' => '',
|
||||
'date_expires' => '',
|
||||
'usage_count' => 0,
|
||||
'individual_use' => false,
|
||||
'product_ids' => array(),
|
||||
'excluded_product_ids' => array(),
|
||||
'usage_limit' => 0,
|
||||
'usage_limit_per_user' => 0,
|
||||
'limit_usage_to_x_items' => 0,
|
||||
'free_shipping' => false,
|
||||
'product_categories' => array(),
|
||||
'excluded_product_categories' => array(),
|
||||
'exclude_sale_items' => false,
|
||||
'minimum_amount' => '',
|
||||
'maximum_amount' => '',
|
||||
'email_restrictions' => array(),
|
||||
'used_by' => array(),
|
||||
);
|
||||
```
|
||||
|
||||
### Getters and setters
|
||||
|
||||
Each one of the keys in this array (property) has a getter and setter, e.g. `set_used_by()` and `get_used_by()`. `$data` itself is private, so the getters and setters must be used to access the data.
|
||||
|
||||
Example getter:
|
||||
|
||||
```php
|
||||
/**
|
||||
* Get records of all users who have used the current coupon.
|
||||
* @since 3.0.0
|
||||
* @param string $context
|
||||
* @return array
|
||||
*/
|
||||
public function get_used_by( $context = 'view' ) {
|
||||
return $this->get_prop( 'used_by', $context );
|
||||
}
|
||||
```
|
||||
|
||||
Example setter:
|
||||
|
||||
```php
|
||||
/**
|
||||
* Set which users have used this coupon.
|
||||
* @since 3.0.0
|
||||
* @param array $used_by
|
||||
* @throws WC_Data_Exception
|
||||
*/
|
||||
public function set_used_by( $used_by ) {
|
||||
$this->set_prop( 'used_by', array_filter( $used_by ) );
|
||||
}
|
||||
```
|
||||
|
||||
`set_prop` and `get_prop` are part of `WC_Data`. These apply various filters (based on context) and handle changes, so we can efficiently save only the props that have changed rather than all props.
|
||||
|
||||
A note on `$context`: when getting data for use on the front end or display, `view` context is used. This applies filters to the data so extensions can change the values dynamically. `edit` context should be used when showing values to edit in the backend, and for saving to the database. Using `edit` context does not apply any filters to the data.
|
||||
|
||||
### The constructor
|
||||
|
||||
The constructor of the CRUD objects facilitates the read from the database. The actual read is not done by the CRUD class, but by its data store.
|
||||
|
||||
Example:
|
||||
|
||||
```php
|
||||
/**
|
||||
* Coupon constructor. Loads coupon data.
|
||||
* @param mixed $data Coupon data, object, ID or code.
|
||||
*/
|
||||
public function __construct( $data = '' ) {
|
||||
parent::__construct( $data );
|
||||
|
||||
if ( $data instanceof WC_Coupon ) {
|
||||
$this->set_id( absint( $data->get_id() ) );
|
||||
} elseif ( is_numeric( $data ) && 'shop_coupon' === get_post_type( $data ) ) {
|
||||
$this->set_id( $data );
|
||||
} elseif ( ! empty( $data ) ) {
|
||||
$this->set_id( wc_get_coupon_id_by_code( $data ) );
|
||||
$this->set_code( $data );
|
||||
} else {
|
||||
$this->set_object_read( true );
|
||||
}
|
||||
|
||||
$this->data_store = WC_Data_Store::load( 'coupon' );
|
||||
if ( $this->get_id() > 0 ) {
|
||||
$this->data_store->read( $this );
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note how it sets the ID based on the data passed to the object, then calls the data store to retrieve the data from the database. Once the data is read via the data store, or if no ID is set, `$this->set_object_read( true );` is set so the data store and CRUD object knows it’s read. Once this is set, changes are tracked.
|
||||
|
||||
### Saving and deleting
|
||||
|
||||
Save and delete methods are optional on CRUD child classes because the `WC_Data` parent class can handle it. When `save` is called, the data store is used to store data to the database. Delete removes the object from the database. `save` must be called for changes to persist, otherwise they will be discarded.
|
||||
|
||||
The save method in `WC_Data` looks like this:
|
||||
|
||||
```php
|
||||
/**
|
||||
* Save should create or update based on object existence.
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @return int
|
||||
*/
|
||||
public function save() {
|
||||
if ( $this->data_store ) {
|
||||
// Trigger action before saving to the DB. Allows you to adjust object props before save.
|
||||
do_action( 'woocommerce_before_' . $this->object_type . '_object_save', $this, $this->data_store );
|
||||
|
||||
if ( $this->get_id() ) {
|
||||
$this->data_store->update( $this );
|
||||
} else {
|
||||
$this->data_store->create( $this );
|
||||
}
|
||||
return $this->get_id();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Update/create is used depending on whether the object has an ID yet. The ID will be set after creation.
|
||||
|
||||
The delete method is like this:
|
||||
|
||||
```php
|
||||
/**
|
||||
* Delete an object, set the ID to 0, and return result.
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @param bool $force_delete
|
||||
* @return bool result
|
||||
*/
|
||||
public function delete( $force_delete = false ) {
|
||||
if ( $this->data_store ) {
|
||||
$this->data_store->delete( $this, array( 'force_delete' => $force_delete ) );
|
||||
$this->set_id( 0 );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
```
|
||||
|
||||
## CRUD usage examples
|
||||
|
||||
### Creating a new simple product
|
||||
|
||||
```php
|
||||
$product = new WC_Product_Simple();
|
||||
$product->set_name( 'My Product' );
|
||||
$product->set_slug( 'myproduct' );
|
||||
$product->set_description( 'A new simple product' );
|
||||
$product->set_regular_price( '9.50' );
|
||||
$product->save();
|
||||
|
||||
$product_id = $product->get_id();
|
||||
```
|
||||
|
||||
### Updating an existing coupon
|
||||
|
||||
```php
|
||||
$coupon = new WC_Coupon( $coupon_id );
|
||||
$coupon->set_discount_type( 'percent' );
|
||||
$coupon->set_amount( 25.00 );
|
||||
$coupon->save();
|
||||
```
|
||||
|
||||
### Retrieving a customer
|
||||
|
||||
```php
|
||||
$customer = new WC_Customer( $user_id );
|
||||
$email = $customer->get_email();
|
||||
$address = $customer->get_billing_address();
|
||||
$name = $customer->get_first_name() . ' ' . $customer->get_last_name();
|
||||
```
|
|
@ -0,0 +1,317 @@
|
|||
# Data Stores
|
||||
|
||||
## Introduction
|
||||
|
||||
Data store classes act as a bridge between WooCommerce's data CRUD classes (`WC_Product`, `WC_Order`, `WC_Customer`, etc) and the database layer. With the database logic separate from data, WooCommerce becomes more flexible. The data stores shipped with WooCommerce core (powered by WordPress' custom posts system and some custom tables) can be swapped out for a different database structure, type, or even be powered by an external API.
|
||||
|
||||
This guide will walk through the structure of a data store class, how to create a new data store, how to replace a core data store, and how to call a data store from your own code.
|
||||
|
||||
The examples in this guide will look at the [`WC_Coupon`](https://github.com/woocommerce/woocommerce/blob/dcecf0f22890f3cd92fbea13a98c11b2537df2a8/includes/class-wc-coupon.php#L19) CRUD data class and [`WC_Coupon_Data_Store_CPT`](https://github.com/woocommerce/woocommerce/blob/dcecf0f22890f3cd92fbea13a98c11b2537df2a8/includes/data-stores/class-wc-coupon-data-store-cpt.php), an implementation of a coupon data store using WordPress custom post types. This is how coupons are currently stored in WooCommerce.
|
||||
|
||||
The important thing to know about `WC_Coupon` or any other CRUD data class when working with data stores is which props (properties) they contain. This is defined in the [`data`](https://github.com/woocommerce/woocommerce/blob/dcecf0f22890f3cd92fbea13a98c11b2537df2a8/includes/class-wc-coupon.php#L26) array of each class.
|
||||
|
||||
## Structure
|
||||
|
||||
Every data store for a CRUD object should implement the `WC_Object_Data_Store_Interface` interface.
|
||||
|
||||
`WC_Object_Data_Store_Interface` includes the following methods:
|
||||
|
||||
* `create`
|
||||
* `read`
|
||||
* `update`
|
||||
* `delete`
|
||||
* `read_meta`
|
||||
* `delete_meta`
|
||||
* `add_meta`
|
||||
* `update_meta`
|
||||
|
||||
The `create`, `read`, `update`, and `delete` methods should handle the CRUD logic for your props:
|
||||
|
||||
* `create` should create a new entry in the database. Example: Create a coupon.
|
||||
* `read` should query a single entry from the database and set properties based on the response. Example: Read a coupon.
|
||||
* `update` should make changes to an existing entry. Example: Update or edit a coupon.
|
||||
* `delete` should remove an entry from the database. Example: Delete a coupon.
|
||||
|
||||
All data stores must implement handling for these methods.
|
||||
|
||||
In addition to handling your props, other custom data can be passed. This is considered `meta`. For example, coupons can have custom data provided by plugins.
|
||||
|
||||
The `read_meta`, `delete_meta`, `add_meta`, and `update_meta` methods should be defined so meta can be read and managed from the correct source. In the case of our WooCommerce core classes, we define them in `WC_Data_Store_WP` and then use the same code for all of our data stores. They all use the WordPress meta system. You can redefine these if meta should come from a different source.
|
||||
|
||||
Your data store can also implement other methods to replace direct queries. For example, the coupons data store has a public `get_usage_by_user_id` method. Data stores should always define and implement an interface for the methods they expect, so other developers know what methods they need to write. Put another way, in addition to the `WC_Object_Data_Store_Interface` interface, `WC_Coupon_Data_Store_CPT` also implements `WC_Coupon_Data_Store_Interface`.
|
||||
|
||||
## Replacing a data store
|
||||
|
||||
Let's look at how we would replace the `WC_Coupon_Data_Store_CPT` class with a `WC_Coupon_Data_Store_Custom_Table` class. Our examples will just provide stub functions, instead of a full working solution. Imagine that we would like to store coupons in a table named `wc_coupons` with the following columns:
|
||||
|
||||
```text
|
||||
id, code, amount, date_created, date_modified, discount_type, description, date_expires, usage_count,individual_use, product_ids, excluded_product_ids, usage_limit, usage_limit_per_user, limit_usage_to_x_items, free_shipping, product_categories, excluded_product_categories, exclude_sale_items, minimum_amount, maximum_amount, email_restrictions, used_by
|
||||
```
|
||||
|
||||
These column names match 1 to 1 with prop names.
|
||||
|
||||
First we would need to create a new data store class to contain our logic:
|
||||
|
||||
```php
|
||||
/**
|
||||
* WC Coupon Data Store: Custom Table.
|
||||
*/
|
||||
class WC_Coupon_Data_Store_Custom_Table extends WC_Data_Store_WP implements WC_Coupon_Data_Store_Interface, WC_Object_Data_Store_Interface {
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Note that we implement the main `WC_Object_Data_Store_Interface` interface as well as the ` WC_Coupon_Data_Store_Interface` interface. Together, these represent all the methods we need to provide logic for.
|
||||
|
||||
We would then define the CRUD handling for these properties:
|
||||
|
||||
```php
|
||||
/**
|
||||
* Method to create a new coupon in the database.
|
||||
*
|
||||
* @param WC_Coupon
|
||||
*/
|
||||
public function create( &$coupon ) {
|
||||
$coupon->set_date_created( current_time( 'timestamp' ) );
|
||||
|
||||
/**
|
||||
* This is where code for inserting a new coupon would go.
|
||||
* A query would be built using getters: $coupon->get_code(), $coupon->get_description(), etc.
|
||||
* After the INSERT operation, we want to pass the new ID to the coupon object.
|
||||
*/
|
||||
$coupon->set_id( $coupon_id );
|
||||
|
||||
// After creating or updating an entry, we need to also cause our 'meta' to save.
|
||||
$coupon->save_meta_data();
|
||||
|
||||
// Apply changes let's the object know that the current object reflects the database and no "changes" exist between the two.
|
||||
$coupon->apply_changes();
|
||||
|
||||
// It is helpful to provide the same hooks when an action is completed, so that plugins can interact with your data store.
|
||||
do_action( 'woocommerce_new_coupon', $coupon_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to read a coupon.
|
||||
*
|
||||
* @param WC_Coupon
|
||||
*/
|
||||
public function read( &$coupon ) {
|
||||
$coupon->set_defaults();
|
||||
|
||||
// Read should do a check to see if this is a valid coupon
|
||||
// and otherwise throw an 'Invalid coupon.' exception.
|
||||
// For valid coupons, set $data to contain our database result.
|
||||
// All props should be set using set_props with output from the database. This "hydates" the CRUD data object.
|
||||
$coupon_id = $coupon->get_id();
|
||||
$coupon->set_props( array(
|
||||
'code' => $data->code,
|
||||
'description' => $data->description,
|
||||
// ..
|
||||
) );
|
||||
|
||||
|
||||
// We also need to read our meta data into the object.
|
||||
$coupon->read_meta_data();
|
||||
|
||||
// This flag reports if an object has been hydrated or not. If this ends up false, the database hasn't correctly set the object.
|
||||
$coupon->set_object_read( true );
|
||||
do_action( 'woocommerce_coupon_loaded', $coupon );
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a coupon in the database.
|
||||
*
|
||||
* @param WC_Coupon
|
||||
*/
|
||||
public function update( &$coupon ) {
|
||||
// Update coupon query, using the getters.
|
||||
|
||||
$coupon->save_meta_data();
|
||||
$coupon->apply_changes();
|
||||
do_action( 'woocommerce_update_coupon', $coupon->get_id() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a coupon from the database.
|
||||
*
|
||||
* @param WC_Coupon
|
||||
* @param array $args Array of args to pass to the delete method.
|
||||
*/
|
||||
public function delete( &$coupon, $args = array() ) {
|
||||
// A lot of objects in WordPress and WooCommerce support
|
||||
// the concept of trashing. This usually is a flag to move the object
|
||||
// to a "recycling bin". Since coupons support trashing, your layer should too.
|
||||
// If an actual delete occurs, set the coupon ID to 0.
|
||||
|
||||
$args = wp_parse_args( $args, array(
|
||||
'force_delete' => false,
|
||||
) );
|
||||
|
||||
$id = $coupon->get_id();
|
||||
|
||||
if ( $args['force_delete'] ) {
|
||||
// Delete Query
|
||||
$coupon->set_id( 0 );
|
||||
do_action( 'woocommerce_delete_coupon', $id );
|
||||
} else {
|
||||
// Trash Query
|
||||
do_action( 'woocommerce_trash_coupon', $id );
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
We are extending `WC_Data_Store_WP` so our classes will continue to use WordPress' meta system.
|
||||
|
||||
As mentioned in the structure section, we are responsible for implementing the methods defined by `WC_Coupon_Data_Store_Interface`. Each interface describes the methods and parameters it accepts, and what your function should do.
|
||||
|
||||
A coupons replacement would look like the following:
|
||||
|
||||
```php
|
||||
/**
|
||||
* Increase usage count for current coupon.
|
||||
*
|
||||
* @param WC_Coupon
|
||||
* @param string $used_by Either user ID or billing email
|
||||
*/
|
||||
public function increase_usage_count( &$coupon, $used_by = '' ) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrease usage count for current coupon.
|
||||
*
|
||||
* @param WC_Coupon
|
||||
* @param string $used_by Either user ID or billing email
|
||||
*/
|
||||
public function decrease_usage_count( &$coupon, $used_by = '' ) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of uses for a coupon by user ID.
|
||||
*
|
||||
* @param WC_Coupon
|
||||
* @param id $user_id
|
||||
* @return int
|
||||
*/
|
||||
public function get_usage_by_user_id( &$coupon, $user_id ) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a coupon code for a specific ID.
|
||||
* @param int $id
|
||||
* @return string Coupon Code
|
||||
*/
|
||||
public function get_code_by_id( $id ) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of IDs for for a specific coupon code.
|
||||
* Can return multiple to check for existence.
|
||||
* @param string $code
|
||||
* @return array Array of IDs.
|
||||
*/
|
||||
public function get_ids_by_code( $code ) {
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Once all the data store methods are defined and logic written, we need to tell WooCommerce to load our new class instead of the built-in class. This is done using the `woocommerce_data_stores` filter. An array of data store slugs is mapped to default WooCommerce classes. Example:
|
||||
|
||||
```php
|
||||
'coupon' => 'WC_Coupon_Data_Store_CPT',
|
||||
'customer' => 'WC_Customer_Data_Store',
|
||||
'customer-download' => 'WC_Customer_Download_Data_Store',
|
||||
'customer-session' => 'WC_Customer_Data_Store_Session',
|
||||
'order' => 'WC_Order_Data_Store_CPT',
|
||||
'order-refund' => 'WC_Order_Refund_Data_Store_CPT',
|
||||
'order-item' => 'WC_Order_Item_Data_Store',
|
||||
'order-item-coupon' => 'WC_Order_Item_Coupon_Data_Store',
|
||||
'order-item-fee' => 'WC_Order_Item_Fee_Data_Store',
|
||||
'order-item-product' => 'WC_Order_Item_Product_Data_Store',
|
||||
'order-item-shipping' => 'WC_Order_Item_Shipping_Data_Store',
|
||||
'order-item-tax' => 'WC_Order_Item_Tax_Data_Store',
|
||||
'payment-token' => 'WC_Payment_Token_Data_Store',
|
||||
'product' => 'WC_Product_Data_Store_CPT',
|
||||
'product-grouped' => 'WC_Product_Grouped_Data_Store_CPT',
|
||||
'product-variable' => 'WC_Product_Variable_Data_Store_CPT',
|
||||
'product-variation' => 'WC_Product_Variation_Data_Store_CPT',
|
||||
'shipping-zone' => 'WC_Shipping_Zone_Data_Store',
|
||||
```
|
||||
|
||||
We specifically want to target the coupon data store, so we would do something like this:
|
||||
|
||||
```php
|
||||
function myplugin_set_wc_coupon_data_store( $stores ) {
|
||||
$stores['coupon'] = 'WC_Coupon_Data_Store_Custom_Table';
|
||||
return $stores;
|
||||
}
|
||||
|
||||
add_filter( 'woocommerce_data_stores', 'myplugin_set_wc_coupon_data_store' );
|
||||
```
|
||||
|
||||
Our class would then be loaded by WooCommerce core, instead of `WC_Coupon_Data_Store_CPT`.
|
||||
|
||||
## Creating a new data store
|
||||
|
||||
### Defining a new product type
|
||||
|
||||
Does your extension create a new product type? Each product type has a data store in addition to a parent product data store. The parent store handles shared properties like name or description and the child handles more specific data.
|
||||
|
||||
For example, the external product data store handles "button text" and "external URL". The variable data store handles the relationship between parent products and their variations.
|
||||
|
||||
Check out [this walkthrough](https://developer.woocommerce.com/2017/02/06/wc-2-7-extension-compatibility-examples-3-bookings/) for more information on this process.
|
||||
|
||||
### Data store for custom data
|
||||
|
||||
If your extension introduces a new database table, new custom post type, or some new form of data not related to products, orders, etc, then you should implement your own data store.
|
||||
|
||||
Your data store should still implement `WC_Object_Data_Store_Interface` and provide the normal CRUD functions. Your data store should be the main point of entry for interacting with your data, so any other queries or operations should also have methods.
|
||||
|
||||
The [shipping zone data store](https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/includes/data-stores/class-wc-shipping-zone-data-store.php) serves as a good example for a "simple" data store using a custom table. The coupons code is a good example for a data store using a custom post type.
|
||||
|
||||
All you need to do to register your data store is add it to the `woocommerce_data_stores` filter:
|
||||
|
||||
```php
|
||||
function myplugin_set_my_custom_data_store( $stores ) {
|
||||
$stores['mycustomdata'] = 'WC_My_Custom_Data_Store';
|
||||
return $stores;
|
||||
}
|
||||
|
||||
add_filter( 'woocommerce_data_stores', 'myplugin_set_my_custom_data_store' );
|
||||
```
|
||||
|
||||
You can then load your data store like any other WooCommerce data store.
|
||||
|
||||
## Calling a data store
|
||||
|
||||
Calling a data store is as simple as using the static `WC_Data_Store::load()` method:
|
||||
|
||||
```php
|
||||
// Load the shipping zone data store.
|
||||
$data_store = WC_Data_Store::load( 'shipping-zone' );
|
||||
// Get the number of shipping methods for zone ID 4.
|
||||
$num_of_methods = $data_store->get_method_count( 4 );
|
||||
```
|
||||
|
||||
You can also chain methods:
|
||||
|
||||
```php
|
||||
// Get the number of shipping methods for zone ID 4.
|
||||
$num_of_methods = WC_Data_Store::load( 'shipping-zone' )->get_method_count( 4 );
|
||||
```
|
||||
|
||||
The `::load()` method works for any data store registered to `woocommerce_data_stores`, so you could load your custom data store:
|
||||
|
||||
```php
|
||||
$data_store = WC_Data_Store::load( 'mycustomdata' );
|
||||
```
|
||||
|
||||
## Data store limitations and WP Admin
|
||||
|
||||
Currently, several WooCommerce screens still rely on WordPress to list objects. Examples of this include coupons and products.
|
||||
|
||||
If you replace data via a data store, some parts of the existing UI may fail. An example of this may be lists of coupons when using the `type` filter. This filter uses meta data, and is in turn passed to WordPress which runs a query using the `WP_Query` class. This cannot handle data outside of the regular meta tables (Ref #19937). To get around this, usage of `WP_Query` would need to be deprecated and replaced with custom query classes and functions.
|
|
@ -0,0 +1,117 @@
|
|||
# Building your first extension
|
||||
|
||||
The easiest way to get started building an extension is to use the built-in extension generator that is included alongside WooCommerce Admin. This utility is maintained as part of the codebase for WooCommerce Admin, so it includes up-to-date tools and many preconfigured settings for building modern extensions that take advantage of the [React-powered](https://react.dev/) user experience available in current versions of WordPress and WooCommerce.
|
||||
|
||||
## Using the extension generator
|
||||
|
||||
Browse to your local WooCommerce Admin repository
|
||||
|
||||
```sh
|
||||
cd /your/server/wp-content/plugins/woocommerce-admin
|
||||
```
|
||||
|
||||
Run the extension generator command
|
||||
|
||||
```sh
|
||||
npm run create-wc-extension
|
||||
```
|
||||
|
||||
The extension generator will scaffold out a basic extension and place it in its own plugin directory alongside WooCommerce on your local server.
|
||||
|
||||
The extension that the generator creates contains a simple [boilerplate](https://stackoverflow.com/questions/3992199/what-is-boilerplate-code) that handles much of the configuration needed for setting up a React-powered extension, which you can modify to fit your needs.
|
||||
|
||||
## The architecture of a basic WooCommerce extension
|
||||
|
||||
WooCommerce extensions use a combination of PHP and modern JavaScript to create a seamless user experience for merchants and shoppers that takes advantage of the features and functionality available in the [NodeJS](https://nodejs.org/en) ecosystem while still being a good neighbor within the underlying WordPress application environment.
|
||||
|
||||
WordPress plugins (of which WooCommerce extensions are a specialized subset), tend to follow a few common patterns. You can read more about common WordPress plugin architecture in the [Best Practices chapter of the WordPress Plugin Developer Handbook](https://developer.wordpress.org/plugins/plugin-basics/best-practices/#architecture-patterns).
|
||||
|
||||
In addition to the main PHP file that all WordPress plugins must contain, a WooCommerce extension will typically contain additional PHP files with classes that assist in server-side functionality.
|
||||
|
||||
It will also contain files that are JavaScript and CSS assets which shape the client-side behavior and appearance.
|
||||
|
||||
## File structure generated by the `create-wc-extension script`
|
||||
|
||||
When you run the built-in extension generator, it will output something that looks similar to the structure below.
|
||||
|
||||
```sh
|
||||
.
|
||||
├── README.md
|
||||
├── my-great-extension.php
|
||||
├── package.json
|
||||
├── src
|
||||
│ ├── index.js
|
||||
│ └── index.scss
|
||||
└── webpack.config.js
|
||||
```
|
||||
|
||||
Here’s a breakdown of what these files are and what purpose they serve:
|
||||
|
||||
`README.md`
|
||||
This file is meant to have a high-level overview of your extension to make it easier for people to use and extend your project. The generator outputs a basic file with some minimal instructions in it to get you started, but you should replace the contents of the file with information specific to your project. It’s important to keep in mind that this file is not the same as the readme.txt file required by WordPress.org plugin directory, which must adhere to specific file standads.
|
||||
|
||||
`[your-extension-name].php`
|
||||
This is your extension’s main PHP file. It functions as the entry point for your extension and is where you’ll likely include code that hooks your extension into WordPress and WooCommerce. You can read more about the purpose of this file in the Getting Started section of the WordPress Plugin Developer Handbook.
|
||||
|
||||
`package.json`
|
||||
This is a manifest file that Node uses for a number of different purposes. It can store configuration settings for tools, lists of dependencies, aliases for common scripts, and even metadata about your extension. The WooCommerce extension generator outputs a package.json file that will bundle many helpful dependencies with your extension, as well as a variety of scripts you can use in conjunction with these dependencies to streamline your workflow and make sure your extension conforms to the same standards as other WordPress plugins and WooCommerce extensions. Here’s an example of what your package.json file might look like initially:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "my-great-extension",
|
||||
"title": "my-great-extension",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"version": "0.1.0",
|
||||
"description": "my-great-extension",
|
||||
"scripts": {
|
||||
"build": "wp-scripts build",
|
||||
"check-engines": "wp-scripts check-engines",
|
||||
"check-licenses": "wp-scripts check-licenses",
|
||||
"format:js": "wp-scripts format-js",
|
||||
"lint:css": "wp-scripts lint-style",
|
||||
"lint:js": "wp-scripts lint-js",
|
||||
"lint:md:docs": "wp-scripts lint-md-docs",
|
||||
"lint:md:js": "wp-scripts lint-md-js",
|
||||
"lint:pkg-json": "wp-scripts lint-pkg-json",
|
||||
"packages-update": "wp-scripts packages-update",
|
||||
"start": "wp-scripts start",
|
||||
"test:e2e": "wp-scripts test-e2e",
|
||||
"test:unit": "wp-scripts test-unit-js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wordpress/scripts": "^12.2.1",
|
||||
"@woocommerce/eslint-plugin": "1.1.0",
|
||||
"@woocommerce/dependency-extraction-webpack-plugin": "1.1.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The settings in this autogenerated file tell Webpack to use the default configuration included with the `@wordpress/scripts` package (listed in your `package.json` as a development dependency) and to override the plugin it uses for dependency extraction with one that is tailor-made for WooCommerce extensions.
|
||||
|
||||
## Try out your extension
|
||||
|
||||
If you used the extension generator to create your extension, you’ll need to complete a few final steps to see it in action.
|
||||
|
||||
First, navigate to your extension’s root directory on your development server:
|
||||
|
||||
```sh
|
||||
cd /your/server/wc-content/plugins/your-extension/
|
||||
```
|
||||
|
||||
Then install the project’s dependencies.
|
||||
|
||||
```sh
|
||||
npm install
|
||||
```
|
||||
|
||||
Finally, run the start script to generate an initial build of your extension. This script will also continuously watch your local files for changes.
|
||||
|
||||
```sh
|
||||
npm start
|
||||
```
|
||||
|
||||
Once your initial build is complete, you can browse to the administrative area of your local WordPress environment and activate your extension. If everything worked as it should, you should see a message in your browser’s JavaScript console:
|
||||
|
||||
```sh
|
||||
hello world
|
||||
```
|
|
@ -0,0 +1,205 @@
|
|||
# Setting up your development environment
|
||||
|
||||
## Introduction
|
||||
|
||||
Building an extension for WooCommerce is a straightforward process, but there are a several moving parts and a few supporting software tools you’ll want to familiarize yourself with. This guide will walk you through the steps of getting a basic development environment set up for building WooCommerce extensions.
|
||||
|
||||
If you would like to contribute to the WooCommerce core platform; please read our [contributor documentation and guidelines](https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### Recommended reading
|
||||
|
||||
WooCommerce extensions are a specialized type of WordPress plugin. If you are new to WordPress plugin development, take a look at a few of these articles in the [WordPress Plugin Developer Handbook](https://developer.wordpress.org/plugins/).
|
||||
|
||||
### Required software
|
||||
|
||||
[Git](https://git-scm.com/)
|
||||
[nvm](https://github.com/nvm-sh/nvm/blob/master/README.md)
|
||||
[NodeJS](https://nodejs.org/en)
|
||||
[PNpm](https://pnpm.io/)
|
||||
[Composer](https://getcomposer.org/download/)
|
||||
|
||||
Note: If you’re working on a Windows machine, you may want to take a look at the Building Extensions in Windows Environments section of this guide before proceeding.
|
||||
|
||||
### Setting up your reusable WordPress development environment
|
||||
|
||||
In addition to the software listed above, you’ll also want to have some way of setting up a local development server stack. There are a number of different tools available for this, each with a certain set of functionality and limitations. We recommend choosing an option below that fits your preferred workflow best.
|
||||
|
||||
### WordPress-specific tools
|
||||
|
||||
[vvv](https://varyingvagrantvagrants.org/) – A highly configurable, cross-platform, and robust environment management tool powered by VirtualBox and Vagrant. This is one the tool that the WooCommerce Core team recommends to contributors.
|
||||
|
||||
[wp-env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) – 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.
|
||||
|
||||
[LocalWP](https://localwp.com/) – A cross-platform app that bills itself as a one-click WordPress installation.
|
||||
|
||||
### General PHP-based web stack tools
|
||||
|
||||
[MAMP](https://www.mamp.info/en/mac/) – A local server environment that can be installed on Mac or Windows.
|
||||
|
||||
[WAMP](https://www.wampserver.com/en/) – A Windows web development environment that lets you create applications with Apache2, PHP, and MySQL.
|
||||
|
||||
[XAMPP](https://www.apachefriends.org/index.html) – An easy-to-install Apache distribution containing MariaDB, PHP, and Perl. It’s available for Windows, Linux, and OS X.
|
||||
|
||||
### Minimum server requirements
|
||||
|
||||
Regardless of the tool you choose for managing your development environment, you should make sure it [meets the server recommendations](https://woocommerce.com/document/server-requirements/?utm_source=wooextdevguide) for WooCommerce as well as the [requirements for running WordPress](https://wordpress.org/about/requirements/).
|
||||
|
||||
## Anatomy of a WordPress development environment (public_html/)
|
||||
|
||||
While development environments can vary, the basic file structure for a WordPress environment should be consistent.
|
||||
|
||||
When developing a WooCommerce extension, you’ll usually be doing most of your work within the public_html directory of your local server. For now, take some time to familiarize yourself with a few key paths:
|
||||
|
||||
`wp-content/debug.log` – This is the file where WordPress writes the important output such as errors and other messages useful for debugging.
|
||||
|
||||
`wp-content/plugins/` – This is the directory on the server where WordPress plugin folders live.
|
||||
|
||||
`wp-content/themes/` – This is the directory on the server where WordPress theme folders live.
|
||||
|
||||
## Adding WooCommerce Core to your environment
|
||||
|
||||
When developing an extension for WooCommerce, it’s helpful to install a development version of WooCommerce core.
|
||||
|
||||
### Clone the WC Core repo into `wp-content/plugins/`
|
||||
|
||||
```sh
|
||||
cd /your/server/wp-content/plugins
|
||||
git clone https://github.com/woocommerce/woocommerce.git
|
||||
cd woocommerce
|
||||
```
|
||||
|
||||
### Activate the required Node version
|
||||
|
||||
```sh
|
||||
nvm use
|
||||
|
||||
Found '/path/to/woocommerce/.nvmrc' with version <v12>
|
||||
Now using node v12.21.0 (npm v6.14.11)
|
||||
```
|
||||
|
||||
Note: if you don’t have the required version of Node installed, NVM will alert you so you can install it:
|
||||
|
||||
```sh
|
||||
Found '/path/to/woocommerce/.nvmrc' with version <v12>
|
||||
N/A: version "v12 -> N/A" is not yet installed.
|
||||
|
||||
You need to run "nvm install v12" to install it before using it.
|
||||
```
|
||||
|
||||
### Install dependencies
|
||||
|
||||
```sh
|
||||
pnpm install && composer install
|
||||
```
|
||||
|
||||
### Build WooCommerce
|
||||
|
||||
```sh
|
||||
pnpm run build
|
||||
```
|
||||
|
||||
Running this script will compile the JavaScript and CSS that WooCommerce needs to operate. If you try to run WooCommerce on your server without generating the compiled assets, you may experience errors and other unwanted side-effects.
|
||||
|
||||
Note: In some environments, you may see an out-of-memory error when you try to build WooCommerce. If this happens, you simply need to adjust the memory_limit setting in your environment’s php.ini configuration to a higher value. The process for changing this value varies depending on the environment management tooling you use, so it’s best to consult your tool’s documentation before making any changes.
|
||||
|
||||
## Adding WooCommerce Admin to your environment
|
||||
|
||||
Installing a development version of WooCommerce Admin will give you access to some helpful utilities such as a built-in script for generating React-powered WooCommerce extensions.
|
||||
|
||||
### Clone the WC Admin repo into `wp-content/plugins/`
|
||||
|
||||
```sh
|
||||
cd /your/server/wp-content/plugins
|
||||
git clone https://github.com/woocommerce/woocommerce-admin.git
|
||||
cd woocommerce-admin
|
||||
```
|
||||
|
||||
### Activate the required Node version
|
||||
|
||||
```sh
|
||||
nvm use
|
||||
Found '/path/to/woocommerce-admin/.nvmrc' with version <lts/*>
|
||||
Now using node v14.16.0 (npm v6.14.11)
|
||||
```
|
||||
|
||||
Note: if you don’t have the required version of Node installed, NVM will alert you so you can install it.
|
||||
|
||||
```sh
|
||||
Found '/path/to/woocommerce-admin/.nvmrc' with version <v12>
|
||||
N/A: version "lts/* -> N/A" is not yet installed.
|
||||
|
||||
You need to run "nvm install lts/*" to install it before using it.
|
||||
```
|
||||
|
||||
Pro-tip: WooCommerce Admin may require a different version of Node than WooCommerce Core requires. Keep this in mind when navigating between directories using the same shell session. As a best practice, always make sure to activate the correct version of Node using nvm use before running any commands inside a cloned repository.
|
||||
|
||||
### Install dependencies
|
||||
|
||||
```sh
|
||||
npm install && composer install
|
||||
```
|
||||
|
||||
## Build a development version of WooCommerce Admin
|
||||
|
||||
Building a development version will compile unminified versions of asset files, which is useful when debugging extensions that interact with WooCommerce Admin features.
|
||||
|
||||
```sh
|
||||
npm run dev
|
||||
```
|
||||
|
||||
If you run into trouble when building WooCommerce Admin, take a look at this wiki article for troubleshooting help.
|
||||
|
||||
## Adding WooCommerce Blocks to your environment
|
||||
|
||||
Installing a development version of WooCommerce Blocks is not required in every case, but having a standalone installation of the feature-plugin version of this extension allows you to work with the latest features, which can be helpful for compatibility testing and future-proofing your extension.
|
||||
|
||||
### Clone the WC Blocks repo into `wp-content/plugins/`
|
||||
|
||||
```sh
|
||||
cd /your/server/wp-content/plugins
|
||||
git clone https://github.com/woocommerce/woocommerce-gutenberg-products-block.git
|
||||
cd woocommerce-gutenberg-products-block
|
||||
```
|
||||
|
||||
### Activate the required Node version
|
||||
|
||||
```sh
|
||||
nvm use
|
||||
|
||||
Found '/path/to/woocommerce-gutenberg-products-block/.nvmrc' with version <lts/*>
|
||||
Now using node v14.16.0 (npm v6.14.11)
|
||||
```
|
||||
|
||||
Note: if you don’t have the required version of Node installed, NVM will alert you so you can install it.
|
||||
|
||||
```sh
|
||||
Found '/path/to/woocommerce-gutenberg-products-block/.nvmrc' with version <v12>
|
||||
N/A: version "lts/* -> N/A" is not yet installed.
|
||||
|
||||
You need to run "nvm install lts/*" to install it before using it.
|
||||
```
|
||||
|
||||
Pro-tip: WooCommerce Blocks may require a different version of Node than WooCommerce Core requires. Keep this in mind when navigating between directories using the same shell session. As a best practice, always make sure to activate the correct version of Node using nvm use before running any commands inside a cloned repository.
|
||||
|
||||
### Install dependencies
|
||||
|
||||
```sh
|
||||
npm install && composer install
|
||||
Build the assets
|
||||
npm run build
|
||||
```
|
||||
|
||||
This will compile and minify the JavaScript and CSS from the /assets directory to be served.
|
||||
|
||||
## Finishing up
|
||||
|
||||
Once you have WooCommerce and its sibling extensions installed in your WordPress environment, start up your server, browse to your site and handle any initial setup steps or importing you’d like to do. This is a good time to load sample data and activate themes and plugins.
|
||||
|
||||
Depending on which extensions you installed in your environment you should have one or more of the following directories in your `public_html` directory:
|
||||
|
||||
- `wp-content/plugins/woocommerce`
|
||||
- `wp-content/plugins/woocommerce-admin`
|
||||
- `wp-content/plugins/woocommerce-gutenberg-products-block`
|
||||
- `wp-content/themes/storefront`
|
|
@ -0,0 +1,231 @@
|
|||
# WooCommerce Extension Developer Handbook
|
||||
|
||||
Want to create a plugin to extend WooCommerce? WooCommerce extensions are the same as regular WordPress plugins. For more information, visit [Writing a plugin](https://www.google.com/url?q=https://developer.wordpress.org/plugins/&sa=D&source=editors&ust=1692724061394513&usg=AOvVaw1PmatucFlJ3lI0z15KYBFq).
|
||||
|
||||
Your WooCommerce extension should:
|
||||
|
||||
- Adhere to all WordPress plugin coding standards, as well as [best practice guidelines](https://www.google.com/url?q=https://developer.wordpress.org/plugins/plugin-basics/best-practices/&sa=D&source=editors&ust=1692724061394795&usg=AOvVaw1vZcSq6JuW0VNm3HhUSb9s) for harmonious existence within WordPress and alongside other WordPress plugins.
|
||||
- Have a single core purpose and use WooCommerce features as much as possible.
|
||||
- Not do anything malicious, illegal, or dishonest — for example, inserting spam links or executable code via third-party systems if not part of the service or explicitly permitted in the service’s terms of use.
|
||||
- Adhere to WooCommerce [compatibility and interoperability guidelines](https://www.google.com/url?q=https://woocommerce.com/document/marketplace-overview/%23section-9&sa=D&source=editors&ust=1692724061395243&usg=AOvVaw2qsdAnXBb2o2dmrTg_QKaa).
|
||||
|
||||
Merchants make use of WooCommerce extensions daily, and should have a unified and pleasant experience while doing so without advertising invading their WP Admin or store.
|
||||
|
||||
Note: We provide this page as a best practice for developers.
|
||||
|
||||
## [Check if WooCommerce is active](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-1&sa=D&source=editors&ust=1692724061395542&usg=AOvVaw2bTUi1Q7fivFhe-Gc3VULl)
|
||||
|
||||
Most WooCommerce plugins do not need to run unless WooCommerce is already active. You can wrap your plugin in a check to see if WooCommerce is installed:
|
||||
|
||||
```
|
||||
// Test to see if WooCommerce is active (including network activated).
|
||||
|
||||
$plugin_path = trailingslashit( WP_PLUGIN_DIR ) . 'woocommerce/woocommerce.php';
|
||||
|
||||
if (
|
||||
|
||||
in_array( $plugin_path, wp_get_active_and_valid_plugins() )
|
||||
|
||||
|| in_array( $plugin_path, wp_get_active_network_plugins() )
|
||||
|
||||
) {
|
||||
|
||||
// Custom code here. WooCommerce is active, however it has not
|
||||
|
||||
// necessarily initialized (when that is important, consider
|
||||
|
||||
// using the \`woocommerce_init\` action).
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Note that this check will fail if the WC plugin folder is named anything other than woocommerce.
|
||||
|
||||
## [Main file naming](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-2&sa=D&source=editors&ust=1692724061396656&usg=AOvVaw0bg5CY1zbmVRBUpvcbFoWc)
|
||||
|
||||
The main plugin file should adopt the name of the plugin, e.g., A plugin with the directory name plugin-name would have its main file named plugin-name.php.
|
||||
|
||||
## [Text domains](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-3&sa=D&source=editors&ust=1692724061397135&usg=AOvVaw2mG8ZyvrV7HLq35afWjwcw)
|
||||
|
||||
Follow guidelines for [Internationalization for WordPress Developers](https://www.google.com/url?q=https://codex.wordpress.org/I18n_for_WordPress_Developers&sa=D&source=editors&ust=1692724061397498&usg=AOvVaw3sWMtUFCwi2CM4BnCL9T3w), the text domain should match your plugin directory name, e.g., A plugin with a directory name of plugin-name would have the text domain plugin-name. Do not use underscores.
|
||||
|
||||
## [Localization](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-4&sa=D&source=editors&ust=1692724061397875&usg=AOvVaw0aN3CAxkWHDXAaOEAt_XLg)
|
||||
|
||||
All text strings within the plugin code should be in English. This is the WordPress default locale, and English should always be the first language. If your plugin is intended for a specific market (e.g., Spain or Italy), include appropriate translation files for those languages within your plugin package. Learn more at [Using Makepot to translate your plugin](https://www.google.com/url?q=https://codex.wordpress.org/I18n_for_WordPress_Developers%23Translating_Plugins_and_Themes&sa=D&source=editors&ust=1692724061398312&usg=AOvVaw1KI1tPNBz1PhXghD6EPeFX).
|
||||
|
||||
## [Follow WordPress PHP Guidelines](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-5&sa=D&source=editors&ust=1692724061398556&usg=AOvVaw3r1rBtiLQqnd09_uqcbgN1)
|
||||
|
||||
WordPress has a [set of guidelines](https://www.google.com/url?q=http://make.wordpress.org/core/handbook/coding-standards/php/&sa=D&source=editors&ust=1692724061398880&usg=AOvVaw32UFCkh2lVnQ1P11WK5917) to keep all WordPress code consistent and easy to read. This includes quotes, indentation, brace style, shorthand php tags, yoda conditions, naming conventions, and more. Please review the guidelines.
|
||||
|
||||
Code conventions also prevent basic mistakes, as [Apple made with iOS 7.0.6](https://www.google.com/url?q=https://www.imperialviolet.org/2014/02/22/applebug.html&sa=D&source=editors&ust=1692724061399164&usg=AOvVaw0U7fB5ITS8uXELL3MgR3zx).
|
||||
|
||||
## [Custom Database Tables & Data Storage](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-6&sa=D&source=editors&ust=1692724061399464&usg=AOvVaw2baqakEqCZi76lbxB3zjh9)
|
||||
|
||||
Avoid creating custom database tables. Whenever possible, use WordPress [post types](https://www.google.com/url?q=http://codex.wordpress.org/Post_Types%23Custom_Post_Types&sa=D&source=editors&ust=1692724061399803&usg=AOvVaw0flq0h728aDmJWR23oNv0V), [taxonomies](https://www.google.com/url?q=http://codex.wordpress.org/Taxonomies&sa=D&source=editors&ust=1692724061399949&usg=AOvVaw1qbvRfl8wcPI35lvSboCwi), and [options](https://www.google.com/url?q=http://codex.wordpress.org/Creating_Options_Pages&sa=D&source=editors&ust=1692724061400101&usg=AOvVaw3H8WjoRljUHd6q5s8X_Pdi).
|
||||
|
||||
Consider the permanence of your data. Here’s a quick primer:
|
||||
|
||||
- If the data may not always be present (i.e., it expires), use a transient.
|
||||
- If the data is persistent but not always present, consider using the WP Cache.
|
||||
- If the data is persistent and always present, consider the wp_options table.
|
||||
- If the data type is an entity with n units, consider a post type.
|
||||
- If the data is a means or sorting/categorizing an entity, consider a taxonomy.
|
||||
|
||||
Logs should be written to a file using the [WC_Logger](https://www.google.com/url?q=https://woocommerce.com/wc-apidocs/class-WC_Logger.html&sa=D&source=editors&ust=1692724061401335&usg=AOvVaw3mxPgYSD7oL2sCoQNcN1BO) class.
|
||||
|
||||
## [Prevent Data Leaks](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-7&sa=D&source=editors&ust=1692724061401572&usg=AOvVaw3xUKNB9qgJDqnd9RwlY8iT)
|
||||
|
||||
Try to prevent direct access data leaks. Add this line of code after the opening PHP tag in each PHP file:
|
||||
|
||||
```
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
```
|
||||
|
||||
## [Readme](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-8&sa=D&source=editors&ust=1692724061402226&usg=AOvVaw0phoD93bjkbxKs01VSxbm_)
|
||||
|
||||
All plugins need a [standard WordPress readme](https://www.google.com/url?q=http://wordpress.org/plugins/about/readme.txt&sa=D&source=editors&ust=1692724061402537&usg=AOvVaw0CxV8gQGI6n0FztcJ_yxwr).
|
||||
|
||||
Your readme might look something like this:
|
||||
|
||||
```
|
||||
=== Plugin Name ===
|
||||
Contributors: (this should be a list of wordpress.org userid's)
|
||||
Tags: comments, spam
|
||||
Requires at least: 4.0.1
|
||||
Tested up to: 4.3
|
||||
Requires PHP: 5.6
|
||||
Stable tag: 4.3
|
||||
License: GPLv3 or later License
|
||||
URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
```
|
||||
|
||||
## [Plugin Author Name](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-9&sa=D&source=editors&ust=1692724061403627&usg=AOvVaw0C49AD_KHbRbjBvuZif55T)
|
||||
|
||||
To ensure a consistent experience for all WooCommerce users,including finding information on who to contact with queries, the following plugin headers should be in place:
|
||||
|
||||
- The Plugin Author isYourName/YourCompany
|
||||
- The Developer header is YourName/YourCompany, with the Developer URI field listed as http://yourdomain.com/
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
/**
|
||||
* Plugin Name: WooCommerce Extension
|
||||
* Plugin URI: http://woocommerce.com/products/woocommerce-extension/
|
||||
* Description: Your extension's description text.
|
||||
* Version: 1.0.0
|
||||
* Author: Your Name
|
||||
* Author URI: http://yourdomain.com/
|
||||
* Developer: Your Name
|
||||
* Developer URI: http://yourdomain.com/
|
||||
* Text Domain: woocommerce-extension
|
||||
* Domain Path: /languages
|
||||
*
|
||||
* Woo: 12345:342928dfsfhsf8429842374wdf4234sfd
|
||||
* WC requires at least: 2.2
|
||||
* WC tested up to: 2.3
|
||||
*
|
||||
* License: GNU General Public License v3.0
|
||||
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*/
|
||||
```
|
||||
|
||||
## [Declaring required and supported WooCommerce version](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-10&sa=D&source=editors&ust=1692724061406115&usg=AOvVaw17Ag30ypAdPnc0BXtUdyUo)
|
||||
|
||||
Use the follow headers to declare “required” and “tested up to” versions:
|
||||
|
||||
- WC requires at least
|
||||
- WC tested up to
|
||||
|
||||
## [Plugin URI](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-11&sa=D&source=editors&ust=1692724061406678&usg=AOvVaw2A80jh9ZfkI6nLGIa93Hpm)
|
||||
|
||||
Ensure that the Plugin URI line of the above plugin header is provided. This line should contain the URL of the plugin’s product/sale page or to a dedicated page for the plugin on your website.
|
||||
|
||||
## [Make it Extensible](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-13&sa=D&source=editors&ust=1692724061407164&usg=AOvVaw3UxTnE6_-W2mM5rVyBk6BY)
|
||||
|
||||
Developers should use WordPress actions and filters to allow for modification/customization without requiring users to touch the plugin’s core code base.
|
||||
|
||||
If your plugin creates a front-end output, we recommend to having a templating engine in place so users can create custom template files in their theme’s WooCommerce folder to overwrite the plugin’s template files.
|
||||
|
||||
For more information, check out Pippin’s post on [Writing Extensible Plugins with Actions and Filters](https://www.google.com/url?q=http://code.tutsplus.com/tutorials/writing-extensible-plugins-with-actions-and-filters--wp-26759&sa=D&source=editors&ust=1692724061407755&usg=AOvVaw1RO30KUvw73kAb73j2Mjxs).
|
||||
|
||||
## [Use of External Libraries](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-14&sa=D&source=editors&ust=1692724061408050&usg=AOvVaw064nKRX-btaU6-rP2nDvPR)
|
||||
|
||||
The use of entire external libraries is typically not suggested as this can open up the product to security vulnerabilities. If an external library is absolutely necessary, developers should be thoughtful about the code used and assume ownership as well as of responsibility for it. Try to only include the strictly necessary part of the library, or use a WordPress-friendly version or opt to build your own version. For example, if needing to use a text editor such as TinyMCE, we recommend using the WordPress-friendly version, TinyMCE Advanced.
|
||||
|
||||
## [Remove Unused Code](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-15&sa=D&source=editors&ust=1692724061408520&usg=AOvVaw1xpjcmMrZLm46Jgpa_VJdb)
|
||||
|
||||
With version control, there’s no reason to leave commented-out code; it’s annoying to scroll through and read. Remove it and add it back later if needed.
|
||||
|
||||
## [Comment](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-16&sa=D&source=editors&ust=1692724061408902&usg=AOvVaw1ZMYYAAWMyPDO1S4YMKRLL)
|
||||
|
||||
If you have a function, what does the function do? There should be comments for most if not all functions in your code. Someone/You may want to modify the plugin, and comments are helpful for that. We recommend using [PHP Doc Blocks](https://www.google.com/url?q=http://en.wikipedia.org/wiki/PHPDoc&sa=D&source=editors&ust=1692724061409214&usg=AOvVaw0pK1khHhpHhP1aU6Wfgg7l) similar to [WooCommerce](https://www.google.com/url?q=https://github.com/woocommerce/woocommerce/&sa=D&source=editors&ust=1692724061409366&usg=AOvVaw3UOb2ML3qmjH-MUwEYxwZN).
|
||||
|
||||
## [Avoid God Objects](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-17&sa=D&source=editors&ust=1692724061409596&usg=AOvVaw1jhRY0Ozls9pwiMi12lNkG)
|
||||
|
||||
[God Objects](https://www.google.com/url?q=http://en.wikipedia.org/wiki/God_object&sa=D&source=editors&ust=1692724061409851&usg=AOvVaw0XP2zyCLmDVwGMwNj0XxF8) are objects that know or do too much. The point of object-oriented programming is to take a large problem and break it into smaller parts. When functions do too much, it’s hard to follow their logic, making bugs harder to fix. Instead of having massive functions, break them down into smaller pieces.
|
||||
|
||||
## [Test Extension Quality & Security with Quality Insights Tool](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-18&sa=D&source=editors&ust=1692724061410124&usg=AOvVaw3WxIdaWb-loeDgk5idgYh7)
|
||||
|
||||
Integrate the [Quality Insights Toolkit (QIT)](https://www.google.com/url?q=https://href.li/?https://woocommerce.github.io/qit-documentation/%23/&sa=D&source=editors&ust=1692724061410435&usg=AOvVaw3-rM1B3-aofWDpJB5y-9Qs) into your development workflow to ensure your extension adheres to WordPress / WooCommerce quality and security standards. The QIT allows the ability to test your extensions against new releases of PHP, WooCommerce, and WordPress, as well as other active extensions, at the same time. The following tests are available today:
|
||||
|
||||
- [End-to-End](https://www.google.com/url?q=https://href.li/?https://woocommerce.github.io/qit-documentation/%23/test-types/e2e&sa=D&source=editors&ust=1692724061410720&usg=AOvVaw2-K7A2Jp9eEE3I7yg5GtLw)
|
||||
- [Activation](https://www.google.com/url?q=https://href.li/?https://woocommerce.github.io/qit-documentation/%23/test-types/activation&sa=D&source=editors&ust=1692724061410980&usg=AOvVaw3EGJl6KSaQL1ygcvoDFFvR)
|
||||
- [Security](https://www.google.com/url?q=https://href.li/?https://woocommerce.github.io/qit-documentation/%23/test-types/security&sa=D&source=editors&ust=1692724061411228&usg=AOvVaw3t5gYK8Md1UQWZORTmKSSx)
|
||||
- [PHPStan](https://www.google.com/url?q=https://href.li/?https://woocommerce.github.io/qit-documentation/%23/test-types/phpstan&sa=D&source=editors&ust=1692724061411473&usg=AOvVaw0cYoAE7ScAXqMU7aw5gAOB)
|
||||
- [API](https://www.google.com/url?q=https://href.li/?https://woocommerce.github.io/qit-documentation/%23/test-types/api&sa=D&source=editors&ust=1692724061411713&usg=AOvVaw0dXv3dyfNaAwe6wiwqApHn)
|
||||
|
||||
## [Test Your Code with WP_DEBUG](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-19&sa=D&source=editors&ust=1692724061411947&usg=AOvVaw3UsBUZeYvFu9v4itS839zy)
|
||||
|
||||
Always develop with [WP_DEBUG](https://www.google.com/url?q=http://codex.wordpress.org/Debugging_in_WordPress&sa=D&source=editors&ust=1692724061412254&usg=AOvVaw1412x2vFGfPDqCXxohD-JF) mode on, so you can see all PHP warnings sent to the screen. This will flag things like making sure a variable is set before checking the value.
|
||||
|
||||
## [Separate Business Logic & Presentation Logic](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-20&sa=D&source=editors&ust=1692724061412504&usg=AOvVaw1-plFhPYmTkkU99E9IO3VN)
|
||||
|
||||
It’s a good practice to separate business logic (i.e., how the plugin works) from [presentation logic](https://www.google.com/url?q=http://en.wikipedia.org/wiki/Presentation_logic&sa=D&source=editors&ust=1692724061412782&usg=AOvVaw3graTlf6ciHm0E3N25NOMQ) (i.e., how it looks). Two separate pieces of logic are more easily maintained and swapped if necessary. An example is to have two different classes — one for displaying the end results, and one for the admin settings page.
|
||||
|
||||
## [Use Transients to Store Offsite Information](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-21&sa=D&source=editors&ust=1692724061413039&usg=AOvVaw0_S-ooFW3W6n-k4yV3Gbmo)
|
||||
|
||||
If you provide a service via an API, it’s best to store that information so future queries can be done faster and the load on your service is lessened. [WordPress transients](https://www.google.com/url?q=http://codex.wordpress.org/Transients_API&sa=D&source=editors&ust=1692724061413333&usg=AOvVaw2SqfyKOl4wa52wmN_B0iJw) can be used to store data for a certain amount of time.
|
||||
|
||||
## [Logging Data](https://www.google.com/url?q=https://woocommerce.com/document/create-a-plugin/%23section-22&sa=D&source=editors&ust=1692724061413569&usg=AOvVaw1Rz8wUNYXdGr4LnOCiOpQM)
|
||||
|
||||
You may want to log data that can be useful for debugging purposes. This is great with two conditions:
|
||||
|
||||
- Allow any logging as an ‘opt in’.
|
||||
- Use the [WC_Logger](https://www.google.com/url?q=https://woocommerce.com/wc-apidocs/class-WC_Logger.html&sa=D&source=editors&ust=1692724061414103&usg=AOvVaw1Xl7lewASbQMGaV8Frgq-U) class. A user can then view logs on their system status page.
|
||||
|
||||
If adding logging to your extension, here’s a snippet for presenting a link to the logs, in a way the extension user can easily make use of.
|
||||
|
||||
```
|
||||
$label = \_\_( 'Enable Logging', 'your-textdomain-here' );
|
||||
|
||||
$description = \_\_( 'Enable the logging of errors.', 'your-textdomain-here' );
|
||||
|
||||
if ( defined( 'WC_LOG_DIR' ) ) {
|
||||
|
||||
$log_url = add_query_arg( 'tab', 'logs', add_query_arg( 'page', 'wc-status', admin_url( 'admin.php' ) ) );
|
||||
|
||||
$log_key = 'your-plugin-slug-here-' . sanitize_file_name( wp_hash( 'your-plugin-slug-here' ) ) . '-log';
|
||||
|
||||
$log_url = add_query_arg( 'log_file', $log_key, $log_url );
|
||||
|
||||
$label .= ' | ' . sprintf( \_\_( '%1$sView Log%2$s', 'your-textdomain-here' ), '<a href\="' . esc_url( $log_url ) . '">', '</a\>' );
|
||||
|
||||
}
|
||||
|
||||
$form_fields\['wc_yourpluginslug_debug'\] = array(
|
||||
|
||||
'title' => \_\_( 'Debug Log', 'your-textdomain-here' ),
|
||||
|
||||
'label' => $label,
|
||||
|
||||
'description' => $description,
|
||||
|
||||
'type' => 'checkbox',
|
||||
|
||||
'default' => 'no'
|
||||
|
||||
);
|
||||
```
|
|
@ -0,0 +1,50 @@
|
|||
# Handling deactivation and uninstallation
|
||||
|
||||
## Introduction
|
||||
|
||||
There are a number of cleanup tasks you’ll need to handle when a merchant deactivates or uninstalls your extension. This guide provides a brief overview of WooCommerce-specific items you’ll want to make sure you account for when defining your extension’s deactivation and uninstallation logic.
|
||||
|
||||
## Removing Scheduled Actions
|
||||
|
||||
If your extension uses Action Scheduler to queue any background jobs, it’s important to unschedule those actions when your extension is uninstalled or deactivated.
|
||||
|
||||
`as_unschedule_all_actions( $hook, $args, $group );`
|
||||
|
||||
You can read more about using Action Scheduler for managing background processing in the [Action Scheduler API Reference](https://actionscheduler.org/api/).
|
||||
|
||||
## Removing Admin Notes
|
||||
|
||||
If you have created any Notes for merchants, you should delete those notes when your extension is deactivated or, at the very least, when it is uninstalled.
|
||||
|
||||
```php
|
||||
function my_great_extension_deactivate() {
|
||||
ExampleNote::possibly_delete_note();
|
||||
}
|
||||
register_deactivation_hook( __FILE__, 'my_great_extension_deactivate' );
|
||||
|
||||
```
|
||||
|
||||
The example above assumes that you have followed the pattern this guide recommends for creating Notes as dedicated classes that include the `NoteTraits` trait included with WooCommerce Admin. This approach provides your Note with some baked in functionality that streamlines note operations such as creation and deletion.
|
||||
|
||||
## Removing Admin Tasks
|
||||
|
||||
When your extension is deactivated or uninstalled, you should take care to unregister any tasks that your extension created for merchants.
|
||||
|
||||
```php
|
||||
// Unregister task.
|
||||
function my_extension_deactivate_task() {
|
||||
remove_filter( 'woocommerce_get_registered_extended_tasks', 'my_extension_register_the_task', 10, 1 );
|
||||
}
|
||||
|
||||
register_deactivation_hook( __FILE__, 'my_extension_deactivate_task' );
|
||||
```
|
||||
|
||||
Keep in mind that merchant tasks are managed via a hybrid approach that involves both PHP and JavaScript, so the client-side registration only happens when your extension’s JavaScript runs.
|
||||
|
||||
## Unregistering navigation
|
||||
|
||||
When your extension deactivates and uninstalls, any registration you’ve done with the WooCommerce Navigation will be handled automatically.
|
||||
|
||||
## WordPress cleanup tasks
|
||||
|
||||
There are additional measures you may need to consider when your extension is deactivated or uninstalled, depending on the types of modifications it makes to the underlying WordPress environment when it activates and runs. You can read more about handling deactivation and uninstallation in the [WordPress Plugin Developer Handbook](https://developer.wordpress.org/plugins/intro/).
|
|
@ -0,0 +1,655 @@
|
|||
# Handling merchant onboarding
|
||||
|
||||
## Introduction
|
||||
|
||||
Onboarding is a critical part of the merchant’s user experience. It helps set them up for success and ensures they’re not only using your extension correctly but also getting the most out of it. There are a few especially useful features that you can take advantage of as a developer to help onboard merchants who are using your extension:
|
||||
|
||||
- Setup tasks
|
||||
- Store management links
|
||||
- Admin notes
|
||||
|
||||
---
|
||||
|
||||
## Using setup tasks
|
||||
|
||||
Setup tasks appear on the WooCommerce Admin home screen and prompt a merchant to complete certain steps in order to set up your extension. Adding tasks is a two-step process that requires:
|
||||
|
||||
- Registering the task (and its JavaScript) using PHP
|
||||
- Using JavaScript to build the task, set its configuration, and add it to the task list
|
||||
|
||||
### Registering the task with PHP
|
||||
|
||||
To register your task as an extended task list item, you’ll need to hook in to the `woocommerce_get_registered_extended_tasks` filter with a function that appends your task to the array the filter provides.
|
||||
|
||||
```php
|
||||
// Task registration
|
||||
function my_extension_register_the_task( $registered_tasks_list_items ) {
|
||||
$new_task_name = 'your_task_name';
|
||||
if ( ! in_array( $new_task_name, $registered_tasks_list_items, true ) ) {
|
||||
array_push( $registered_tasks_list_items, $new_task_name );
|
||||
}
|
||||
return $registered_tasks_list_items;
|
||||
}
|
||||
add_filter( 'woocommerce_get_registered_extended_tasks', 'my_extension_register_the_task', 10, 1 );
|
||||
```
|
||||
|
||||
### Registering the task’s JavaScript
|
||||
|
||||
In addition to registering the task name, you’ll also need to register and enqueue the transpiled JavaScript file containing your task component, its configuration, and its event-handlers. A common way to do this is to create a dedicated registration function that hooks into the `admin_enqueue_scripts` action in WordPress. If you do things this way, you can nest the `add_filter` call for `woocommerce_get_registered_extended_tasks` in this function as well. Below is an annotated example of how this registration might look:
|
||||
|
||||
```php
|
||||
// Register the task list item and the JS.
|
||||
function add_task_register_script() {
|
||||
|
||||
// Check to make sure that this is a request for an Admin page.
|
||||
if (
|
||||
! class_exists( 'Automattic\WooCommerce\Admin\Loader' ) ||
|
||||
! \Automattic\WooCommerce\Admin\Loader::is_admin_page() ||
|
||||
! Onboarding::should_show_tasks()
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Register a handle for your extension's transpiled JavaScript file.
|
||||
wp_register_script(
|
||||
'add-task',
|
||||
plugins_url( '/dist/index.js', __FILE__ ),
|
||||
array(
|
||||
'wp-hooks',
|
||||
'wp-element',
|
||||
'wp-i18n',
|
||||
'wc-components',
|
||||
),
|
||||
filemtime( dirname( __FILE__ ) . '/dist/index.js' ),
|
||||
true
|
||||
);
|
||||
|
||||
// Get server-side data via PHP and send it to the JavaScript using wp_localize_script
|
||||
$client_data = array(
|
||||
'isComplete' => get_option( 'woocommerce_admin_add_task_example_complete', false ),
|
||||
);
|
||||
wp_localize_script( 'add-task', 'addTaskData', $client_data );
|
||||
|
||||
// Enqueue the script in WordPress
|
||||
wp_enqueue_script( 'add-task' );
|
||||
|
||||
// Hook your task registration script to the relevant extended tasks filter
|
||||
add_filter( 'woocommerce_get_registered_extended_tasks', 'my_extension_register_the_task', 10, 1 );
|
||||
}
|
||||
```
|
||||
|
||||
### Unregistering the task upon deactivation
|
||||
|
||||
It is also helpful to define a function that will unregister your task when your extension is deactivated.
|
||||
|
||||
```php
|
||||
// Unregister task.
|
||||
function my_extension_deactivate_task() {
|
||||
remove_filter( 'woocommerce_get_registered_extended_tasks', 'my_extension_register_the_task', 10, 1 );
|
||||
}
|
||||
|
||||
register_deactivation_hook( __FILE__, 'my_extension_deactivate_task' );
|
||||
|
||||
```
|
||||
|
||||
### Adding the task using JavaScript
|
||||
|
||||
Once the task has been registered in WooCommerce, you need to build the task component, set its configuration, and add it to the task list. For example, the JavaScript file for a simple task might look something like this:
|
||||
|
||||
```js
|
||||
// External dependencies.
|
||||
import { addFilter } from '@wordpress/hooks';
|
||||
import apiFetch from '@wordpress/api-fetch';
|
||||
import { Card, CardBody } from '@wordpress/components';
|
||||
|
||||
// WooCommerce dependencies.
|
||||
import { getHistory, getNewPath } from '@woocommerce/navigation';
|
||||
|
||||
// Event handler for handling mouse clicks that mark a task complete.
|
||||
const markTaskComplete = () => {
|
||||
// Here we're using apiFetch to set option values in WooCommerce.
|
||||
apiFetch( {
|
||||
path: '/wc-admin/options',
|
||||
method: 'POST',
|
||||
data: { woocommerce_admin_add_task_example_complete: true },
|
||||
} )
|
||||
.then( () => {
|
||||
// Set the local `isComplete` to `true` so that task appears complete on the list.
|
||||
addTaskData.isComplete = true;
|
||||
// Redirect back to the root WooCommerce Admin page.
|
||||
getHistory().push( getNewPath( {}, '/', {} ) );
|
||||
} )
|
||||
.catch( ( error ) => {
|
||||
// Something went wrong with our update.
|
||||
console.log( error );
|
||||
} );
|
||||
};
|
||||
|
||||
// Event handler for handling mouse clicks that mark a task incomplete.
|
||||
const markTaskIncomplete = () => {
|
||||
apiFetch( {
|
||||
path: '/wc-admin/options',
|
||||
method: 'POST',
|
||||
data: { woocommerce_admin_add_task_example_complete: false },
|
||||
} )
|
||||
.then( () => {
|
||||
addTaskData.isComplete = false;
|
||||
getHistory().push( getNewPath( {}, '/', {} ) );
|
||||
} )
|
||||
.catch( ( error ) => {
|
||||
console.log( error );
|
||||
} );
|
||||
};
|
||||
|
||||
// Build the Task component.
|
||||
const Task = () => {
|
||||
return (
|
||||
<Card className="woocommerce-task-card">
|
||||
<CardBody>
|
||||
Example task card content.
|
||||
<br />
|
||||
<br />
|
||||
<div>
|
||||
{ addTaskData.isComplete ? (
|
||||
<button onClick={ markTaskIncomplete }>
|
||||
Mark task incomplete
|
||||
</button>
|
||||
) : (
|
||||
<button onClick={ markTaskComplete }>
|
||||
Mark task complete
|
||||
</button>
|
||||
) }
|
||||
</div>
|
||||
</CardBody>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
// Use the 'woocommerce_admin_onboarding_task_list' filter to add a task.
|
||||
addFilter(
|
||||
'woocommerce_admin_onboarding_task_list',
|
||||
'plugin-domain',
|
||||
( tasks ) => {
|
||||
return [
|
||||
...tasks,
|
||||
{
|
||||
key: 'example',
|
||||
title: 'Example',
|
||||
content: 'This is an example task.',
|
||||
container: <Task />,
|
||||
completed: addTaskData.isComplete,
|
||||
visible: true,
|
||||
additionalInfo: 'Additional info here',
|
||||
time: '2 minutes',
|
||||
isDismissable: true,
|
||||
onDismiss: () => console.log( 'The task was dismissed' ),
|
||||
},
|
||||
];
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
In the example above, the extension does a few different things. Let’s break it down:
|
||||
|
||||
#### Handle imports
|
||||
|
||||
First, import any functions, components, or other utilities from external dependencies. We’ve kept WooCommerce-related dependencies separate from others for the sake of keeping things tidy. In a real-world extension, you may be importing other local modules. In those cases, we recommend creating a visually separate section for those imports as well.
|
||||
|
||||
```js
|
||||
// External dependencies
|
||||
import { addFilter } from '@wordpress/hooks'``;
|
||||
import apiFetch from '@wordpress/api-fetch'``;
|
||||
import { Card, CardBody } from '@wordpress/components'``;
|
||||
|
||||
// WooCommerce dependencies
|
||||
import { getHistory, getNewPath } from '@woocommerce/navigation'``;
|
||||
```
|
||||
|
||||
The `addFilter` function allows us to hook in to JavaScript filters the same way that the traditional PHP call to `add_filter()` does. The `apiFetch` utility allows our extension to query the WordPress REST API without needing to deal with keys or authentication. Finally, the `Card` and `CardBody` are predefined React components that we’ll use as building blocks for our extension’s Task component.
|
||||
|
||||
#### Create Event Handlers
|
||||
|
||||
Next we define the logic for the functions that will handle events for our task. In the example above, we created two functions to handle mouse clicks that toggle the completion status of our task.
|
||||
|
||||
```js
|
||||
const markTaskComplete = () => {
|
||||
apiFetch( {
|
||||
path: '/wc-admin/options',
|
||||
method: 'POST',
|
||||
data: { woocommerce_admin_add_task_example_complete: true },
|
||||
} )
|
||||
.then( () => {
|
||||
addTaskData.isComplete = true;
|
||||
getHistory().push( getNewPath( {}, '/', {} ) );
|
||||
} )
|
||||
.catch( ( error ) => {
|
||||
console.log( error );
|
||||
} );
|
||||
};
|
||||
```
|
||||
|
||||
In the example above, the event handler uses `apiFetch` to set the `woocommerce_admin_add_task_example_complete` option’s value to `true` and then updates the component’s state data and redirects the browser to the Admin root. In the case of an error, we’re simply logging it to the console, but you may want to implement your own solution here.
|
||||
|
||||
The `markTaskIncomplete` function is more or less an inverse of `markTaskComplete` that toggles the task’s completion status in the opposite direction.
|
||||
|
||||
#### Construct the component
|
||||
|
||||
Next, we create a [functional component](https://reactjs.org/docs/components-and-props.html) that returns our task card. The intermixed JavaScript/HTML syntax we’re using here is called JSX. If you’re unfamiliar with it, you can [read more about it in the React docs](https://reactjs.org/docs/introducing-jsx.html).
|
||||
|
||||
```js
|
||||
const Task = () => {
|
||||
return (
|
||||
<Card className="woocommerce-task-card">
|
||||
<CardBody>
|
||||
Example task card content.
|
||||
<br />
|
||||
<br />
|
||||
<div>
|
||||
{ addTaskData.isComplete ? (
|
||||
<button onClick={ markTaskIncomplete }>
|
||||
Mark task incomplete
|
||||
</button>
|
||||
) : (
|
||||
<button onClick={ markTaskComplete }>
|
||||
Mark task complete
|
||||
</button>
|
||||
) }
|
||||
</div>
|
||||
</CardBody>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
In the example above, we’re using the `Card` and `CardBody` components to construct our task’s component. The `div` inside the `CardBody` uses a [JavaScript expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Expressions) (`{}`) to embed a ternary operator that uses the component’s state to determine whether to display the task as complete or incomplete.
|
||||
|
||||
#### Configure task and add it to the WooCommerce task list
|
||||
|
||||
Finally, we’ll set some configuration values for our task and then use the `addFilter` function to append our task to the WooCommerce Admin Onboarding Task List.
|
||||
|
||||
```js
|
||||
addFilter(
|
||||
'woocommerce_admin_onboarding_task_list',
|
||||
'plugin-domain',
|
||||
( tasks ) => {
|
||||
return [
|
||||
...tasks,
|
||||
{
|
||||
key: 'example',
|
||||
title: 'Example',
|
||||
content: 'This is an example task.',
|
||||
container: <Task />,
|
||||
completed: addTaskData.isComplete,
|
||||
visible: true,
|
||||
additionalInfo: 'Additional info here',
|
||||
time: '2 minutes',
|
||||
isDismissable: true,
|
||||
onDismiss: () => console.log( 'The task was dismissed' ),
|
||||
},
|
||||
];
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
In the example above, we’re setting our task’s configuration as we pass it into the filter for simplicity, but in a real-world extension, you might encapsulate this somewhere else for better separation of concerns. Below is a list of properties that the task-list component supports for tasks.
|
||||
|
||||
| Name | Type | Required | Description |
|
||||
|----------------|------------|----------|-------------|
|
||||
| key | String | Yes | Identifier |
|
||||
| title | String | Yes | Task title |
|
||||
| content | String | No | The content that will be visible in the Extensions setup list |
|
||||
| container | Component | Yes | The task component that will be visible after selecting the item |
|
||||
| completed | Boolean | Yes | Whether the task is completed or not |
|
||||
| visible | Boolean | Yes | Whether the task is visible or not |
|
||||
| additionalInfo | String | No | Additional information |
|
||||
| time | String | Yes | Time it takes to finish up the task |
|
||||
| isDismissable | Boolean | No | Whether the task is dismissable or not. If false the Dismiss button won’t be visible |
|
||||
| onDismiss | Function | No | Callback method that it’s triggered on dismission |
|
||||
| type | String | Yes | Type of task list item, setup items will be in the store setup and extension in the extensions setup |
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Using Store Management Links
|
||||
|
||||
When a merchant completes all of the items on the onboarding task list, WooCommerce replaces it with a section containing a list of handy store management links. Discoverability can be a challenge for extensions, so this section is a great way to bring more attention to key features of your extension and help merchants navigate to them.
|
||||
|
||||
The store management section has a relatively narrow purpose, so this section does not currently support external links. Instead, it is meant for navigating quickly within WooCommerce.
|
||||
|
||||
Adding your own store management links is a simple process that involves:
|
||||
|
||||
- Installing dependencies for icon support
|
||||
- Enqueuing an admin script in your PHP
|
||||
- Hooking in via a JavaScript filter to provide your link object
|
||||
|
||||
### Installing the Icons package
|
||||
|
||||
Store management links use the `@wordpress/icons` package. If your extension isn’t already using it, you’ll need to add it to your extension’s list of dependencies.
|
||||
|
||||
`npm` `install` ` @wordpress``/icons ` `--save`
|
||||
|
||||
### Enqueuing the JavaScript
|
||||
|
||||
The logic that adds your custom link to the store management section will live in a JavaScript file. We’ll register and enqueue that file with WordPress in our PHP file:
|
||||
|
||||
```js
|
||||
function custom_store_management_link() {
|
||||
wp_enqueue_script(
|
||||
'add-my-custom-link',
|
||||
plugins_url( '/dist/add-my-custom-link.js', __FILE__ ),
|
||||
array( 'wp-hooks' ),
|
||||
10
|
||||
);
|
||||
}
|
||||
add_action( 'admin_enqueue_scripts', 'custom_store_management_link' );
|
||||
|
||||
```
|
||||
|
||||
The first argument of this call is a handle, the name by which WordPress will refer to the script we’re enqueuing. The second argument is the URL where the script is located.
|
||||
|
||||
The third argument is an array of script dependencies. By supplying the `wp-hooks` handle in that array, we’re ensuring that our script will have access to the `addFilter` function we’ll be using to add our link to WooCommerce’s list.
|
||||
|
||||
The fourth argument is a priority, which determines the order in which JavaScripts are loaded in WordPress. We’re setting a priority of 10 in our example. It’s important that your script runs before the store management section is rendered. With that in mind, make sure your priority value is lower than 15 to ensure your link is rendered properly.
|
||||
|
||||
### Supply your link via JavaScript
|
||||
|
||||
Finally, in the JavaScript file you enqueued above, hook in to the `woocommerce_admin_homescreen_quicklinks` filter and supply your task as a simple JavaScript object.
|
||||
|
||||
```js
|
||||
import { megaphone } from '@wordpress/icons';
|
||||
import { addFilter } from '@wordpress/hooks';
|
||||
|
||||
addFilter(
|
||||
'woocommerce_admin_homescreen_quicklinks',
|
||||
'my-extension',
|
||||
( quickLinks ) => {
|
||||
return [
|
||||
...quickLinks,
|
||||
{
|
||||
title: 'My link',
|
||||
href: 'link/to/something',
|
||||
icon: megaphone,
|
||||
},
|
||||
];
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Using Admin Notes
|
||||
|
||||
Admin Notes are meant for displaying insightful information about your WooCommerce store, extensions, activity, and achievements. They’re also useful for displaying information that can help with the day-to-day tasks of managing and optimizing a store. A good general rule is to use Admin Notes for information that is:
|
||||
|
||||
1. Timely
|
||||
2. Relevant
|
||||
3. Useful
|
||||
|
||||
With that in mind, you might consider using Admin Notes to celebrate a particular milestone that a merchant has passed, or to provide additional guidance about using a specific feature or flow. Conversely, you shouldn’t use Admin Notes to send repeated messages about the same topic or target all users with a note that is only relevant to a subset of merchants. It’s okay to use Admin Notes for specific promotions, but you shouldn’t abuse the system. Use your best judgement and remember the home screen is meant to highlight a store’s most important actionable tasks.
|
||||
|
||||
Despite being a part of the new React-powered admin experience in WooCommerce, Admin Notes are available to developers via a standard PHP interface.
|
||||
|
||||
The recommended approach for using Admin Notes is to encapsulate your note within its own class that uses the [NoteTraits](https://github.com/woocommerce/woocommerce-admin/blob/831c9ff13a862f22cf53d3ae676daeabbefe90ad/src/Notes/NoteTraits.php) trait included with WooCommerce Admin. Below is a simple example of what this might look like:
|
||||
|
||||
```php
|
||||
<?php
|
||||
/**
|
||||
* Simple note provider
|
||||
*
|
||||
* Adds a note with a timestamp showing when the note was added.
|
||||
*/
|
||||
|
||||
namespace My\Wonderfully\Namespaced\Extension\Area;
|
||||
|
||||
// Exit if this code is accessed outside of WordPress.
|
||||
defined ( 'ABSPATH' ) || exit;
|
||||
|
||||
// Check for Admin Note support
|
||||
if ( ! class_exists( 'Automattic\WooCommerce\Admin\Notes\Notes' ) ||
|
||||
! class_exists( 'Automattic\WooCommerce\Admin\Notes\NoteTraits' )) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the WooCommerce Data Store is available
|
||||
if ( ! class_exists( 'WC_Data_Store' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Example note class.
|
||||
*/
|
||||
class ExampleNote {
|
||||
|
||||
// Use the Note class to create Admin Note objects
|
||||
use Automatic\WooCommerce\Admin\Notes\Note;
|
||||
|
||||
// Use the NoteTraits trait, which handles common note operations.
|
||||
use Automatic\WooCommerce\Admin\Notes\NoteTraits;
|
||||
|
||||
// Provide a note name.
|
||||
const NOTE_NAME = 'my-prefix-example-note';
|
||||
|
||||
public static function get_note() {
|
||||
// Our welcome note will include information about when the extension
|
||||
// was activated. This is just for demonstration. You might include
|
||||
// other logic here depending on what data your note should contain.
|
||||
$activated_time = current_time( 'timestamp', 0 );
|
||||
$activated_time_formatted = date( 'F jS', $activated_time );
|
||||
|
||||
// Instantiate a new Note object
|
||||
$note = new Automattic\WooCommerce\Admin\Notes\Note();
|
||||
|
||||
// Set our note's title.
|
||||
$note->set_title( 'Getting Started' );
|
||||
|
||||
// Set our note's content.
|
||||
$note->set_content(
|
||||
sprintf(
|
||||
'Extension activated on %s.', $activated_time_formatted
|
||||
)
|
||||
);
|
||||
|
||||
// In addition to content, notes also support structured content.
|
||||
// You can use this property to re-localize notes on the fly, but
|
||||
// that is just one use. You can store other data here too. This
|
||||
// is backed by a longtext column in the database.
|
||||
$note->set_content_data( (object) array(
|
||||
'getting_started' => true,
|
||||
'activated' => $activated_time,
|
||||
'activated_formatted' => $activated_time_formatted
|
||||
) );
|
||||
|
||||
// Set the type of the note. Note types are defined as enum-style
|
||||
// constants in the Note class. Available note types are:
|
||||
// error, warning, update, info, marketing.
|
||||
$note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
|
||||
|
||||
// Set the type of layout the note uses. Supported layout types are:
|
||||
// 'banner', 'plain', 'thumbnail'
|
||||
$note->set_layout( 'plain' );
|
||||
|
||||
// Set the image for the note. This property renders as the src
|
||||
// attribute for an img tag, so use a string here.
|
||||
$note->set_image( '' );
|
||||
|
||||
|
||||
// Set the note name and source. You should store your extension's
|
||||
// name (slug) in the source property of the note. You can use
|
||||
// the name property of the note to support multiple sub-types of
|
||||
// notes. This also gives you a handy way of namespacing your notes.
|
||||
$note->set_source( 'inbox-note-example');
|
||||
$note->set_name( self::NOTE_NAME );
|
||||
|
||||
// Add action buttons to the note. A note can support 0, 1, or 2 actions.
|
||||
// The first parameter is the action name, which can be used for event handling.
|
||||
// The second parameter renders as the label for the button.
|
||||
// The third parameter is an optional URL for actions that require navigation.
|
||||
$note->add_action(
|
||||
'settings', 'Open Settings', '?page=wc-settings&tab=general'
|
||||
);
|
||||
$note->add_action(
|
||||
'learn_more', 'Learn More', 'https://example.com'
|
||||
);
|
||||
|
||||
return $note;
|
||||
}
|
||||
}
|
||||
|
||||
function my_great_extension_activate() {
|
||||
// This uses the functionality from the NoteTraits trait to conditionally add your note if it passes all of the appropriate checks.
|
||||
ExampleNote::possibly_add_note();
|
||||
}
|
||||
register_activation_hook( __FILE__, 'my_great_extension_activate' );
|
||||
|
||||
function my_great_extension_deactivate() {
|
||||
// This uses the functionality from the NoteTraits trait to conditionally remove your note if it passes all of the appropriate checks.
|
||||
ExampleNote::possibly_delete_note();
|
||||
}
|
||||
register_deactivation_hook( __FILE__, 'my_great_extension_deactivate' );
|
||||
```
|
||||
|
||||
|
||||
### Breaking it down
|
||||
|
||||
Let’s break down the example above to examine what each section does.
|
||||
|
||||
#### Namespacing and feature availability checks
|
||||
|
||||
First, we’re doing some basic namespacing and feature availability checks, along with a safeguard to make sure this file only executes within the WordPress application space.
|
||||
|
||||
```php
|
||||
namespace My\Wonderfully\Namespaced\Extension\Area;
|
||||
|
||||
defined ( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( ! class_exists( 'Automattic\WooCommerce\Admin\Notes\Notes') ||
|
||||
! class_exists( 'Automattic\WooCommerce\Admin\Notes\NoteTraits') ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'WC_Data_Store' ) ) {
|
||||
return;
|
||||
}
|
||||
```
|
||||
|
||||
#### Using Note and NoteTraits objects
|
||||
|
||||
Next, we define a simple class that will serve as a note provider for our note. To create and manage note objects, we’ll import the `Note` and `NotesTraits` classes from WooCommerce Admin.
|
||||
|
||||
```php
|
||||
class ExampleNote {
|
||||
|
||||
use Automatic\WooCommerce\Admin\Notes\Note;
|
||||
use Automatic\WooCommerce\Admin\Notes\NoteTraits;
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
#### Provide a unique note name
|
||||
|
||||
Before proceeding, create a constant called `NOTE_NAME` and assign a unique note name to it. The `NoteTraits` class uses this constant for queries and note operations.
|
||||
|
||||
`const NOTE_NAME = 'my-prefix-example-note';`
|
||||
|
||||
#### Configure the note’s details
|
||||
|
||||
Once you’ve set your note’s name, you can define and configure your note. The `NoteTraits` class will call `self::get_note()` when performing operations, so you should encapsulate your note’s instantiation and configuration in a static function called `get_note()` that returns a `Note` object.
|
||||
|
||||
```php
|
||||
public static function get_note() {
|
||||
// We'll fill this in with logic that instantiates a Note object
|
||||
// and sets its properties.
|
||||
}
|
||||
```
|
||||
|
||||
Inside our `get_note()` function, we’ll handle any logic for collecting data our Note may need to display. Our example note will include information about when the extension was activated, so this bit of code is just for demonstration. You might include other logic here depending on what data your note should contain.
|
||||
|
||||
```php
|
||||
$activated_time = current_time( 'timestamp', 0);
|
||||
$activated_time_formatted = date( 'F jS', $activated_time );
|
||||
|
||||
```
|
||||
|
||||
Next, we’ll instantiate a new `Note` object.
|
||||
|
||||
`$note = new Note();`
|
||||
|
||||
Once we have an instance of the Note class, we can work with its API to set its properties, starting with its title.
|
||||
|
||||
`$note->set_title( 'Getting Started' );`
|
||||
|
||||
Then we’ll use some of the timestamp data we collected above to set the note’s content.
|
||||
|
||||
```php
|
||||
$note->set_content(
|
||||
sprintf(
|
||||
'Extension activated on %s.', $activated_time_formatted
|
||||
)
|
||||
);
|
||||
```
|
||||
|
||||
In addition to regular content, notes also support structured content using the `content_data` property. You can use this property to re-localize notes on the fly, but that is just one use case. You can store other data here too. This is backed by a `longtext` column in the database.
|
||||
|
||||
```php
|
||||
$note->set_content_data( (object) array(
|
||||
'getting_started' => true,
|
||||
'activated' => $activated_time,
|
||||
'activated_formatted' => $activated_time_formatted
|
||||
) );
|
||||
```
|
||||
|
||||
Next, we’ll set the note’s `type` property. Note types are defined as enum-style class constants in the `Note` class. Available note types are _error_, _warning_, _update_, _info_, and _marketing_. When selecting a note type, be aware that the _error_ and _update_ result in the note being shown as a Store Alert, not in the Inbox. It’s best to avoid using these types of notes unless you absolutely need to.
|
||||
|
||||
`$note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );`
|
||||
|
||||
Admin Notes also support a few different layouts. You can specify `banner`, `plain`, or `thumbnail` as the layout. If you’re interested in seeing the different layouts in action, take a look at [this simple plugin](https://gist.github.com/octaedro/864315edaf9c6a2a6de71d297be1ed88) that you can install to experiment with them.
|
||||
|
||||
We’ll choose `plain` as our layout, but it’s also the default, so we could leave this property alone and the effect would be the same.
|
||||
|
||||
`$note->set_layout( 'plain' );`
|
||||
|
||||
If you have an image that you want to add to your Admin Note, you can specify it using the `set_image` function. This property ultimately renders as the `src` attribute on an `img` tag, so use a string here.
|
||||
|
||||
`$note->set_image( '' );`
|
||||
|
||||
Next, we’ll set the values for our Admin Note’s `name` and `source` properties. As a best practice, you should store your extension’s name (i.e. its slug) in the `source` property of the note. You can use the `name` property to support multiple sub-types of notes. This gives you a handy way of namespacing your notes and managing them at both a high and low level.
|
||||
|
||||
```php
|
||||
$note->set_source( 'inbox-note-example');
|
||||
$note->set_name( self::NOTE_NAME );
|
||||
```
|
||||
|
||||
Admin Notes can support 0, 1, or 2 actions (buttons). You can use these actions to capture events that trigger asynchronous processes or help the merchant navigate to a particular view to complete a step, or even simply to provide an external link for further information. The `add_action()` function takes up to three arguments. The first is the action name, which can be used for event handling, the second renders as a label for the action’s button, and the third is an optional URL for actions that require navigation.
|
||||
|
||||
```php
|
||||
$note->add_action(
|
||||
'settings', 'Open Settings', '?page=wc-settings&tab=general'
|
||||
);
|
||||
$note->add_action(
|
||||
'learn_more', 'Learn More', 'https://example.com'
|
||||
);
|
||||
```
|
||||
|
||||
Finally, remember to have the `get_note()` function return the configured Note object.
|
||||
|
||||
`return $note;`
|
||||
|
||||
#### Adding and deleting notes
|
||||
|
||||
To add and delete notes, you can use the helper functions that are part of the `NoteTraits` class: `possibly_add_note()` and its counterpart `possibly_delete_note()`. These functions will handle some of the repetitive logic related to note management and will also run checks to help you avoid creating duplicate notes.
|
||||
|
||||
Our example extension ties these calls to activation and deactivation hooks for the sake of simplicity. While there are many events for which you may want to add Notes to a merchant’s inbox, deleting notes upon deactivation and uninstallation is an important part of managing your extension’s lifecycle.
|
||||
|
||||
```php
|
||||
function my_great_extension_activate() {
|
||||
ExampleNote::possibly_add_note();
|
||||
}
|
||||
register_activation_hook( __FILE__, 'my_great_extension_activate' );
|
||||
|
||||
function my_great_extension_deactivate() {
|
||||
ExampleNote::possibly_delete_note();
|
||||
}
|
||||
register_deactivation_hook( __FILE__, 'my_great_extension_deactivate' );
|
||||
|
||||
```
|
|
@ -0,0 +1,73 @@
|
|||
# Adding store management links
|
||||
|
||||
## Introduction
|
||||
|
||||
In the new and improved WooCommerce home screen, there are two points of extensibility for plugin developers that have recently had some attention. The first is the setup task list, allowing you to remind the user of tasks they need to complete and keeping track of their progress for them.
|
||||
|
||||
The second is the store management links section. Once the user has completed the setup tasks this will display for them. This section consolidates a list of handy navigation links that merchants can use to quickly find features in WooCommerce.
|
||||
|
||||
Discoverability can be hard for users so this can be a great place to bring attention to the features of your plugin and allow users to easily find their way to the key functionality your plugin provides.
|
||||
|
||||
Adding your own store management links is a simple process.
|
||||
|
||||
## Add your own store management link
|
||||
|
||||
Before we start, let's outline a couple of restrictions on this feature.
|
||||
|
||||
Right now these links are designed to keep the user within WooCommerce, so it does not support external links.
|
||||
|
||||
All the links you add will fall under a special category in the list called "Extensions". There is not currently any support for custom categories.
|
||||
|
||||
With those things in mind, let's start.
|
||||
|
||||
## Step 1 - Enqueue JavaScript
|
||||
|
||||
Adding a store management link will all be done in JavaScript, so the first step is enqueuing your script that will add the store management link. The most important thing here is ensuring that your script runs before the store management link section is rendered.
|
||||
|
||||
To ensure that your script runs before ours you'll need to enqueue it with a priority higher than 15. You'll also need to depend on `wp-hooks` to get access to `addFilter`.
|
||||
|
||||
Example:
|
||||
|
||||
```php
|
||||
function enqueue_management_link_script() {
|
||||
wp_enqueue_script( $script_name, $script_url, array( 'wp-hooks' ), 10 );
|
||||
}
|
||||
|
||||
add_action( 'admin_enqueue_scripts', 'enqueue_management_link_script' );
|
||||
```
|
||||
|
||||
## Step 2 - Install @wordpress/icons
|
||||
|
||||
To provide an icon of your choice for your store management link, you'll need to install `@wordpress/icons` in your JavaScript project:
|
||||
|
||||
```sh
|
||||
npm install @wordpress/icons --save
|
||||
```
|
||||
|
||||
## Step 3 - Add your filter
|
||||
|
||||
Your script will need to use `addFilter` to provide your custom link to the store management link section. And you'll need to import your icon of choice from `@wordpress/icons`. Here's an example:
|
||||
|
||||
```js
|
||||
import { megaphone } from "@wordpress/icons";
|
||||
import { addFilter } from "@wordpress/hooks";
|
||||
|
||||
addFilter(
|
||||
"woocommerce_admin_homescreen_quicklinks",
|
||||
"my-extension",
|
||||
(quickLinks) => {
|
||||
return [
|
||||
...quickLinks,
|
||||
{
|
||||
title: "My link",
|
||||
href: "link/to/something",
|
||||
icon: megaphone,
|
||||
},
|
||||
];
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
Here's a screen shot using our new custom store management link:
|
||||
|
||||
![screen shot of custom store management link in wp-admin](https://i.imgur.com/yvXeSya.png)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue