Merge branch 'trunk' into tools/manifest-post-category-title
This commit is contained in:
commit
021f0be175
|
@ -32,7 +32,7 @@ jobs:
|
|||
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||
run: echo "date=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set all package string
|
||||
id: all_description
|
||||
|
|
|
@ -27,23 +27,16 @@ jobs:
|
|||
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
|
||||
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 }}
|
||||
CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
||||
CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
UPDATE_WC: 'nightly'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
|
||||
- name: Setup local test environment
|
||||
uses: ./.github/actions/tests/setup-local-test-environment
|
||||
with:
|
||||
install-filters: woocommerce
|
||||
build: false
|
||||
test-type: api
|
||||
|
||||
- name: Run API tests
|
||||
id: run-api-composite-action
|
||||
|
@ -51,10 +44,34 @@ jobs:
|
|||
with:
|
||||
report-name: ${{ env.API_ARTIFACT }}
|
||||
env:
|
||||
USER_KEY: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
USER_SECRET: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
BASE_URL: http://localhost:8086
|
||||
USER_KEY: admin
|
||||
USER_SECRET: password
|
||||
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
|
||||
UPDATE_WC: nightly
|
||||
|
||||
- name: Generate Playwright API Test report.
|
||||
id: generate_api_report
|
||||
if: |
|
||||
always() &&
|
||||
(
|
||||
steps.run-api-composite-action.conclusion != 'cancelled' ||
|
||||
steps.run-api-composite-action.conclusion != 'skipped'
|
||||
)
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive Playwright API test report
|
||||
if: |
|
||||
always() &&
|
||||
steps.generate_api_report.conclusion == 'success'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.API_ARTIFACT }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
if-no-files-found: ignore
|
||||
retention-days: 20
|
||||
|
||||
e2e-tests:
|
||||
name: E2E tests on nightly build
|
||||
|
@ -62,45 +79,52 @@ jobs:
|
|||
permissions:
|
||||
contents: read
|
||||
outputs:
|
||||
test-result: ${{ steps.run-e2e-composite-action.outputs.result }}
|
||||
test-result: ${{ steps.run_playwright_e2e_tests.outputs.result }}
|
||||
# needs: [api-tests]
|
||||
env:
|
||||
ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
|
||||
BASE_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
||||
CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup WooCommerce Monorepo
|
||||
uses: ./.github/actions/setup-woocommerce-monorepo
|
||||
|
||||
- name: Setup local test environment
|
||||
uses: ./.github/actions/tests/setup-local-test-environment
|
||||
with:
|
||||
install-filters: woocommerce
|
||||
build: false
|
||||
test-type: e2e
|
||||
|
||||
- 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: ${{ env.E2E_ARTIFACT }}
|
||||
id: run_playwright_e2e_tests
|
||||
env:
|
||||
ADMIN_PASSWORD: ${{ secrets.SMOKE_TEST_ADMIN_PASSWORD }}
|
||||
ADMIN_USER: ${{ secrets.SMOKE_TEST_ADMIN_USER }}
|
||||
ADMIN_USER_EMAIL: ${{ secrets.SMOKE_TEST_ADMIN_USER_EMAIL }}
|
||||
USE_WP_ENV: 1
|
||||
E2E_MAX_FAILURES: 15
|
||||
FORCE_COLOR: 1
|
||||
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
|
||||
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
|
||||
BASE_URL: ${{ secrets.SMOKE_TEST_URL }}
|
||||
CUSTOMER_PASSWORD: ${{ secrets.SMOKE_TEST_CUSTOMER_PASSWORD }}
|
||||
CUSTOMER_USER: ${{ secrets.SMOKE_TEST_CUSTOMER_USER }}
|
||||
DEFAULT_TIMEOUT_OVERRIDE: 120000
|
||||
E2E_MAX_FAILURES: 25
|
||||
RESET_SITE: true
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec playwright test --config=tests/e2e-pw/playwright.config.js
|
||||
|
||||
- name: Generate Test report.
|
||||
if: success() || ( failure() && steps.run_playwright_e2e_tests.conclusion == 'failure' )
|
||||
working-directory: plugins/woocommerce
|
||||
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}
|
||||
|
||||
- name: Archive test report
|
||||
if: success() || ( failure() && steps.run_playwright_e2e_tests.conclusion == 'failure' )
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.E2E_ARTIFACT }}
|
||||
path: |
|
||||
${{ env.ALLURE_RESULTS_DIR }}
|
||||
${{ env.ALLURE_REPORT_DIR }}
|
||||
retention-days: 20
|
||||
|
||||
k6-tests:
|
||||
name: k6 tests on nightly build
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
name: Send PRs that require review to Slack
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [review_requested]
|
||||
issue_comment:
|
||||
types: [created]
|
||||
pull_request_review_comment:
|
||||
types: [created]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
send-pr-to-slack-for-review:
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
WOO_PR_TESTING_REVIEW_TEAM: ${{ secrets.WOO_PR_TESTING_REVIEW_TEAM }}
|
||||
steps:
|
||||
- name: Send ping to Slack for a new review
|
||||
uses: archive/github-actions-slack@d9dae40827adf93bddf939db6552d1e392259d7d
|
||||
id: notify-review
|
||||
if: |
|
||||
(github.event_name == 'pull_request' || github.event_name == 'pull_request_target') &&
|
||||
github.event.action == 'review_requested' &&
|
||||
github.event.requested_team.slug == env.WOO_PR_TESTING_REVIEW_TEAM
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.TEST_ASSISTANCE_BOT_TOKEN }}
|
||||
slack-channel: ${{ secrets.WOO_PR_TESTING_REVIEW_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
<!subteam^${{ secrets.WOO_PR_TESTING_REVIEW_TEAM_ID }}> was asked to review this PR:
|
||||
<${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}> :thread:
|
||||
slack-optional-unfurl_links: false
|
||||
slack-optional-unfurl_media: false
|
||||
|
||||
- name: Send ping to Slack about a new comment
|
||||
uses: archive/github-actions-slack@d9dae40827adf93bddf939db6552d1e392259d7d
|
||||
id: notify-comment
|
||||
if: |
|
||||
(github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') &&
|
||||
contains(github.event.comment.body, env.WOO_PR_TESTING_REVIEW_TEAM)
|
||||
with:
|
||||
slack-bot-user-oauth-access-token: ${{ secrets.TEST_ASSISTANCE_BOT_TOKEN }}
|
||||
slack-channel: ${{ secrets.WOO_PR_TESTING_REVIEW_SLACK_CHANNEL }}
|
||||
slack-text: |
|
||||
<!subteam^${{ secrets.WOO_PR_TESTING_REVIEW_TEAM_ID }}> was mentioned in a comment:
|
||||
<${{ github.event.comment.html_url }}|${{ github.event.issue.title }}> :speech_balloon:
|
||||
slack-optional-unfurl_links: false
|
||||
slack-optional-unfurl_media: false
|
|
@ -177,7 +177,7 @@
|
|||
"packages": [
|
||||
"**"
|
||||
],
|
||||
"pinVersion": "^19.10.3"
|
||||
"pinVersion": "19.10.5"
|
||||
},
|
||||
{
|
||||
"dependencies": [
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# WooCommerce Developer Documentation
|
||||
---
|
||||
post_title: 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!
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# WooCommerce code snippets
|
||||
---
|
||||
post_title: WooCommerce code snippets
|
||||
---
|
||||
|
||||
Various code snippets you can add to your site to enable custom functionality:
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Add a country
|
||||
---
|
||||
post_title: 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.
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Add a currency and symbol
|
||||
---
|
||||
post_title: 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.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Add or modify states
|
||||
---
|
||||
post_title: 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.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Adjust the quantity input values
|
||||
---
|
||||
post_title: Adjust the quantity input values
|
||||
---
|
||||
|
||||
Set the starting value, maximum value, minimum value, and increment amount for quantity input fields on product pages.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Add a message above the login / register form
|
||||
---
|
||||
post_title: Add a message above the login / register form
|
||||
---
|
||||
|
||||
This code will add a custom message above the login/register form on the user’s my-account page.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Rename a country
|
||||
---
|
||||
post_title: Change a currency symbol
|
||||
---
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Customizing checkout fields using actions and filters
|
||||
---
|
||||
post_title: Customizing checkout fields using actions and filters
|
||||
---
|
||||
|
||||
If you are unfamiliar with code and resolving potential conflicts, we have an extension that can help: [WooCommerce Checkout Field Editor](https://woo.com/products/woocommerce-checkout-field-editor/). Installing and activating this extension overrides any code below that you try to implement; and you cannot have custom checkout field code in your functions.php file when the extension is activated.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Change number of related products output
|
||||
---
|
||||
post_title: Change number of related products output
|
||||
---
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Rename a country
|
||||
---
|
||||
post_title: 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.
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Unhook and remove WooCommerce emails
|
||||
---
|
||||
post_title: Unhook and remove WooCommerce emails
|
||||
---
|
||||
|
||||
This code allows you to unhook and remove the default WooCommerce emails.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Useful Core Functions
|
||||
---
|
||||
post_title: Useful core functions
|
||||
---
|
||||
|
||||
WooCommerce core functions are available on both front-end and admin. They can be found in `includes/wc-core-functions.php` and can be used by themes in plugins.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# CSS SASS coding guidelines and naming convetions
|
||||
---
|
||||
post_title: CSS SASS coding guidelines and naming conventions
|
||||
---
|
||||
|
||||
Our guidelines are based on those used in [Calypso](https://github.com/Automattic/wp-calypso) which itself follows the BEM methodology. Refer to [this doc](https://wpcalypso.wordpress.com/devdocs/docs/coding-guidelines/css.md?term=css) for full details. There are a few differences in WooCommerce however which are outlined below;
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# API Critical Flows
|
||||
---
|
||||
post_title: API critical flows
|
||||
---
|
||||
|
||||
In our documentation, we've pinpointed the essential user flows within the WooCommerce Core API. These flows serve as
|
||||
the compass for our testing initiatives, aiding us in concentrating our efforts where they matter most. They also
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Common issues
|
||||
---
|
||||
post_title: Common issues
|
||||
---
|
||||
|
||||
This page aims to document a comprehensive list of known issues, commonly encountered problems, and their solutions or workarounds. If you have encountered an issue that is not mentioned here and should be, please don't hesitate to add to the list.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# How to decide if a Pull Request is High-Impact
|
||||
---
|
||||
post_title: How to decide if a pull request is high impact
|
||||
---
|
||||
|
||||
Deciding if a Pull Request should be declared High-Impact is a complex task. To achieve it, we need to assess and estimate the impact that the changes introduced in the Pull Request have in WooCommerce, which is usually a subjective task and sometimes inaccurate, due to the huge knowledge it demands of the WooCommerce product details, technical details and even customers issues history.
|
||||
|
||||
|
@ -30,6 +32,4 @@ On this page, we will share some guidelines to help you assess the impact degree
|
|||
|
||||
## My PR is High-Impact. What's next?
|
||||
|
||||
If your PR is High-Impact, be sure to label it with `needs: analysis` so that it can get reviewed. If you don't have permission to add labels, please make sure that the **PR reviewers do it**.
|
||||
|
||||
Once the PR labelled as `needs: analysis` is reviewed, it will get added the `impact: high` label if it qualifies for High-Impact and the WooCommerce Core team will keep special considerations for testing it.
|
||||
If your PR is High-Impact, be sure to label it with `impact: high` and the WooCommerce Core team will keep special considerations for testing it.
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Deprecation in Core
|
||||
---
|
||||
post_title: Deprecation in core
|
||||
---
|
||||
|
||||
Deprecation is a method of discouraging usage of a feature or practice in favour of something else without breaking backwards compatibility or totally prohibiting its usage. To quote the Wikipedia article on Deprecation:
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
# Minification of SCSS and JS
|
||||
---
|
||||
post_title: Minification of SCSS and JS
|
||||
---
|
||||
|
||||
## SCSS
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Naming Conventions
|
||||
---
|
||||
post_title: Naming conventions
|
||||
---
|
||||
|
||||
## PHP
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# String localization guidelines
|
||||
---
|
||||
post_title: String localization guidelines
|
||||
---
|
||||
|
||||
1. Use `woocommerce` textdomain in all strings.
|
||||
2. When using dynamic strings in printf/sprintf, if you are replacing > 1 string use numbered args. e.g. `Test %s string %s.` would be `Test %1$s string %2$s.`
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# WooCommerce Git Flow
|
||||
---
|
||||
post_title: WooCommerce Git flow
|
||||
---
|
||||
|
||||
For core development, we use the following structure and flow.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Developing using WooCommerce CRUD objects
|
||||
---
|
||||
post_title: 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.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Data Stores
|
||||
---
|
||||
post_title: Data stores
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
# Adding a Section to a Settings Tab
|
||||
---
|
||||
post_title: Adding a section to a settings tab
|
||||
---
|
||||
|
||||
When you’re adding building an extension for WooCommerce that requires settings of some kind, it’s important to ask yourself: **Where do they belong?** If your extension just has a couple of simple settings, do you really need to create a new tab specifically for it? Most likely the answer is no.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Building your first extension
|
||||
---
|
||||
post_title: 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.
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
# Classes in WooCommerce
|
||||
---
|
||||
post_title: Classes in WooCommerce
|
||||
---
|
||||
|
||||
## [List of Classes in WooCommerce](https://github.com/woocommerce/woocommerce/blob/trunk/docs/extension-development/class-reference#section-1)
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Setting up your development environment
|
||||
---
|
||||
post_title: Setting up your development environment
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# WooCommerce Extension Developer Handbook
|
||||
---
|
||||
post_title: 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://developer.wordpress.org/plugins/).
|
||||
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
---
|
||||
post_title: GDPR Compliance Guidelines for WooCommerce Extensions
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
The General Data Protection Regulation (GDPR) is in effect, granting EU residents increased rights over their personal data. Developers must ensure that WooCommerce extensions are compliant with these regulations.
|
||||
|
||||
## Data Sharing and Collection
|
||||
|
||||
### Third-Party Data Sharing
|
||||
|
||||
- Assess and document any third-party data sharing.
|
||||
- Obtain and manage user consent for data sharing.
|
||||
- Link to third-party privacy policies in your plugin settings.
|
||||
|
||||
### Data Collection
|
||||
|
||||
- List the personal data your plugin collects.
|
||||
- Secure consent for data collection and manage user preferences.
|
||||
- Safeguard data storage and restrict access to authorized personnel.
|
||||
|
||||
## Data Access and Storage
|
||||
|
||||
### Accessing Personal Data
|
||||
|
||||
- Specify what personal data your plugin accesses from WooCommerce orders.
|
||||
- Justify the necessity for accessing each type of data.
|
||||
- Control access to personal data based on user roles and permissions.
|
||||
|
||||
### Storing Personal Data
|
||||
|
||||
- Explain your data storage mechanisms and locations.
|
||||
- Apply encryption to protect stored personal data.
|
||||
- Perform regular security audits.
|
||||
|
||||
## Personal Data Handling
|
||||
|
||||
### Data Exporter and Erasure Hooks
|
||||
|
||||
- Integrate data exporter and erasure hooks to comply with user requests.
|
||||
- Create a user-friendly interface for data management requests.
|
||||
|
||||
### Refusal of Data Erasure
|
||||
|
||||
- Define clear protocols for instances where data erasure is refused.
|
||||
- Communicate these protocols transparently to users.
|
||||
|
||||
## Frontend and Backend Data Exposure
|
||||
|
||||
### Data on the Frontend
|
||||
|
||||
- Minimize personal data displayed on the site's frontend.
|
||||
- Provide configurable settings for data visibility based on user status.
|
||||
|
||||
### Data in REST API Endpoints
|
||||
|
||||
- Ensure REST API endpoints are secure and disclose personal data only as necessary.
|
||||
- Establish clear permissions for accessing personal data via the API.
|
||||
|
||||
## Privacy Documentation and Data Management
|
||||
|
||||
### Privacy Policy Documentation
|
||||
|
||||
- Maintain an up-to-date privacy policy detailing your plugin’s data handling.
|
||||
- Include browser storage methods and third-party data sharing in your documentation.
|
||||
|
||||
### Data Cleanup
|
||||
|
||||
- Implement data cleanup protocols for plugin uninstallation and deletion of orders/users.
|
||||
- Automate personal data removal processes where appropriate.
|
||||
|
||||
## Conclusion
|
||||
|
||||
- Keep a record of GDPR compliance measures and make them accessible to users.
|
||||
- Update your privacy policy regularly to align with any changes in data processing activities.
|
|
@ -1,4 +1,6 @@
|
|||
# Handling deactivation and uninstallation
|
||||
---
|
||||
post_title: Handling deactivation and uninstallation
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Handling merchant onboarding
|
||||
---
|
||||
post_title: Handling merchant onboarding
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Adding store management links
|
||||
---
|
||||
post_title: Adding store management links
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# How to design a simple extension
|
||||
---
|
||||
post_title: How to design a simple extension
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Implementing Settings for Extensions
|
||||
---
|
||||
post_title: Implementing settings for extensions
|
||||
---
|
||||
|
||||
If you’re customizing WooCommerce or adding your own functionality to it you’ll probably need a settings page of some sort. One of the easiest ways to create a settings page is by taking advantage of the [`WC_Integration` class](https://woocommerce.github.io/code-reference/classes/WC-Integration.html 'WC_Integration Class'). Using the Integration class will automatically create a new settings page under **WooCommerce > Settings > Integrations** and it will automatically save, and sanitize your data for you. We’ve created this tutorial so you can see how to create a new integration.
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
# Extension Development
|
||||
---
|
||||
category_title: Extension Development
|
||||
category_slug: extension-development
|
||||
post_title: Extension development
|
||||
---
|
||||
|
||||
> ⚠️ **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!
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Settings API
|
||||
---
|
||||
post_title: Settings API
|
||||
---
|
||||
|
||||
The WooCommerce Settings API is used by extensions to display, save, and load settings. The best way to make use of the API in your extension is to create a class that extends the `WC_Settings_API` class:
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Building blocks for low code builders
|
||||
---
|
||||
post_title: Building blocks for low code builders
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
|
||||
# Using custom attributes in menus and taxonomy archives
|
||||
---
|
||||
post_title: Using custom attributes in menus and taxonomy archives
|
||||
---
|
||||
|
||||
Attributes that can be used for the layered nav are a custom taxonomy, which means you can display them in menus, or display products by attributes. This requires some work on your part, and archives must be enabled.
|
||||
|
||||
> **Note:** This is a **Developer level** doc. If you are unfamiliar with code/templates and resolving potential conflicts, select a [WooExpert or Developer](https://woo.com/customizations/) for assistance. We are unable to provide support for customizations under our [Support Policy](https://woo.com/support-policy/).
|
||||
|
||||
# Register the taxonomy for menus
|
||||
---
|
||||
post_title: Register the taxonomy for menus
|
||||
---
|
||||
|
||||
When registering taxonomies for your custom attributes, WooCommerce calls the following hook:
|
||||
|
||||
|
@ -28,7 +32,9 @@ Custom attribute slugs are prefixed with `pa_`, so an attribute called `size` wo
|
|||
|
||||
Now use your attribute in **Appearance > Menus**. You will notice, however, that it has default blog styling when you click on a link to your taxonomy term.
|
||||
|
||||
# Create a template
|
||||
---
|
||||
post_title: Create a template
|
||||
---
|
||||
|
||||
You need to theme your attribute to make it display products as you want. To do this:
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
post_title: WooCommerce Plugin API Callback Documentation
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This document provides a guide on how to use the WooCommerce Plugin API to initiate callbacks for plugin actions, especially for gateways and classes not initialized by default.
|
||||
|
||||
## Callback URL Structure
|
||||
|
||||
Before WooCommerce 2.0, use:
|
||||
|
||||
`https://example.com/?wc-api=CALLBACK`
|
||||
|
||||
In WooCommerce 2.0 or later, use the endpoint:
|
||||
|
||||
`https://example.com/wc-api/CALLBACK/`
|
||||
|
||||
## Behavior
|
||||
|
||||
When the callback URL is accessed, WooCommerce will:
|
||||
|
||||
- Initialize the `CALLBACK` class, if available
|
||||
- Trigger the `woocommerce_api_callback` action
|
||||
- Exit WordPress
|
||||
|
||||
## Hooking into the API Callback
|
||||
|
||||
To hook into the callback, add an action in your plugin:
|
||||
|
||||
```php
|
||||
add_action( 'woocommerce_api_callback', 'your_callback_handler_function' );
|
||||
```
|
||||
|
||||
## Redirecting After Callback
|
||||
|
||||
It's possible to redirect users after the action has been executed using your custom handler function.
|
|
@ -1,4 +1,6 @@
|
|||
# Resources for debugging
|
||||
---
|
||||
post_title: Resources for debugging
|
||||
---
|
||||
|
||||
## WordPress
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# WooCommerce Developer Resources
|
||||
---
|
||||
post_title: WooCommerce developer resources
|
||||
---
|
||||
|
||||
This guide is a great starting point for WooCommerce development. From setting up your first online store to diving deep into advanced features, you'll find what you need here. New to WooCommerce? Start with the basics. Experienced and looking for specific documentation or community discussions? We've got that covered too. Navigate through the sections below to find the resources tailored for you.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# WooCommerce Developer Tools
|
||||
---
|
||||
post_title: WooCommerce developer tools
|
||||
---
|
||||
|
||||
This guide provides an overview of essential tools and libraries for WooCommerce development. It's intended for developers looking to enhance their WooCommerce projects efficiently.
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
# Getting-started
|
||||
---
|
||||
category_title: Getting Started
|
||||
category_slug: getting-started
|
||||
post_title: Getting started
|
||||
---
|
||||
|
||||
> ⚠️ **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!
|
||||
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
---
|
||||
post_title: Set up and use a child theme
|
||||
---
|
||||
|
||||
**Note:** This document is intended for creating and using classic child themes. For a comprehensive guide on creating a child block theme and understanding the differences between a classic and block theme, please refer to [this detailed documentation](https://learn.wordpress.org/lesson-plan/create-a-basic-child-theme-for-block-themes/).
|
||||
|
||||
|
||||
Sometimes, you might need to customize your theme or WooCommerce beyond what is possible via the options. These guidelines will teach you the basics of how to go about customizing your site by using a child theme.
|
||||
|
||||
## What is a child theme?
|
||||
|
||||
Before we start it’s important that you understand what a child theme is. In short, a child theme is a layer that you put on top of the parent theme to make alterations without having to develop a new theme from scratch. There are two major reasons to use child themes:
|
||||
|
||||
- Theme developers can use child themes as a way to offer variations on a theme, similar to what we do with the [Storefront child themes](https://woo.com/products/storefront/)
|
||||
- Developers can use child themes to host customizations of the parent theme or any plugin on the site since the child theme will get priority over the plugins and parent theme
|
||||
|
||||
Read [this guide from the WordPress Codex](https://developer.wordpress.org/themes/advanced-topics/child-themes/).
|
||||
|
||||
## Make a backup
|
||||
|
||||
Before customizing a website, you should always ensure that you have a backup of your site in case anything goes wrong. More info at: [Backing up WordPress content](https://woo.com/document/backup-wordpress-content/).
|
||||
|
||||
## Getting started
|
||||
|
||||
To get started, we need to prepare a child theme.
|
||||
|
||||
### Making the child theme
|
||||
|
||||
First, we need to create a new stylesheet for our child theme. Create a new file called `style.css` and put this code in it:
|
||||
|
||||
```css
|
||||
/*
|
||||
Theme Name: Child Theme
|
||||
Version: 1.0
|
||||
Description: Child theme for Woo.
|
||||
Author: Woo
|
||||
Author URI: https://woo.com
|
||||
Template: themedir
|
||||
*/
|
||||
```
|
||||
|
||||
Next, we need to change the **Template** field to point to our installed WooTheme. In this example, we’ll use the Storefront theme, which is installed under `wp-content/themes/storefront/`. The result will look like this:
|
||||
|
||||
```css
|
||||
/*
|
||||
Theme Name: Storefront Child
|
||||
Version: 1.0
|
||||
Description: Child theme for Storefront.
|
||||
Author: Woo
|
||||
Author URI: https://woo.com
|
||||
Template: storefront
|
||||
*/
|
||||
|
||||
/* --------------- Theme customization starts here ----------------- */
|
||||
```
|
||||
|
||||
**Note:** With Storefront, you do not need to enqueue any of the parent theme style files with PHP from the theme’s `functions.php` file or `@import` these into the child themes `style.css` file as the main parent Storefront theme does this for you.
|
||||
|
||||
With Storefront, a child theme only requires a blank `functions.php` file and a `style.css` file to get up and running.
|
||||
|
||||
## Uploading and activating
|
||||
|
||||
You can upload the child theme either through your FTP client, or using the Add New theme option in WordPress.
|
||||
|
||||
- **Through FTP.** If you’re using FTP, it means that you go directly to the folders of your website. That means you’ll need **FTP access** to your host, so you can upload the new child theme. If you don’t have this, you should talk to your host and they can give you your FTP login details, and then download an FTP program to upload your files.
|
||||
- **Through the WP Dashboard.** If you create a .zip file of your child theme folder you can then simply upload that to your site from the **WordPress > Appearance > Themes > Add New** section.
|
||||
|
||||
Once you’ve done that, your child theme will be uploaded to a new folder in `wp-content/themes/`, for example, `wp-content/themes/storefront-child/`. Once uploaded, we can go to our **WP Dashboard > Appearance > Themes** and activate the child theme.
|
||||
|
||||
## Customizing design and functionality
|
||||
|
||||
Your child theme is now ready to be modified. Currently, it doesn’t hold any customization, so let’s look at a couple of examples of how we can customize the child theme without touching the parent theme.
|
||||
|
||||
### Design customization
|
||||
|
||||
Let’s do an example together where we change the color of the site title. Add this to your `/storefront-child/style.css`:
|
||||
|
||||
```css
|
||||
.site-branding h1 a {
|
||||
color: red;
|
||||
}
|
||||
```
|
||||
|
||||
After saving the file and refreshing our browser, you will now see that the color of the site title has changed!
|
||||
|
||||
### Template changes
|
||||
|
||||
**Note:** This doesn’t apply to Storefront child themes. Any customizations to a Storefront child theme’s files will be lost when updating. Instead of customizing the Storefront child theme’s files directly, we recommended that you add code snippets to a customization plugin. We’ve created one to do just this. Download [Theme Customizations](https://github.com/woocommerce/theme-customisations) for free.
|
||||
|
||||
But wait, there’s more! You can do the same with the template files (`*.php`) in the theme folder. For example if w, wanted to modify some code in the header, we need to copy header.php from our parent theme folder `wp-content/themes/storefront/header.php` to our child theme folder `wp-content/themes/storefront-child/header.php`. Once we have copied it to our child theme, we edit `header.php` and customize any code we want. The `header.php` in the child theme will be used instead of the parent theme’s `header.php`.
|
||||
|
||||
The same goes for WooCommerce templates. If you create a new folder in your child theme called “WooCommerce”, you can make changes to the WooCommerce templates there to make it more in line with the overall design of your website. More on WooCommerce’s template structure [can be found here](https://woo.com/document/template-structure/).
|
||||
|
||||
### Functionality changes
|
||||
|
||||
**NOTE**: The functions.php in your child theme should be **empty** and not include anything from the parent theme’s functions.php.
|
||||
|
||||
The `functions.php` in your child theme is loaded **before** the parent theme’s `functions.php`. If a function in the parent theme is **pluggable**, it allows you to copy a function from the parent theme into the child theme’s `functions.php` and have it replace the one in your parent theme. The only requirement is that the parent theme’s function is **pluggable**, which basically means it is wrapped in a conditional if statement e.g:
|
||||
|
||||
```php
|
||||
if ( ! function_exists( "parent_function_name" ) ) {
|
||||
parent_function_name() {
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If the parent theme function is **pluggable**, you can copy it to the child theme `functions.php` and modify the function to your liking.
|
||||
|
||||
## Template directory vs stylesheet directory
|
||||
|
||||
WordPress has a few things that it handles differently in child themes. If you have a template file in your child theme, you have to modify how WordPress includes files. `get_template_directory()` will reference the parent theme. To make it use the file in the child theme, you need to change use `get_stylesheet_directory();`.
|
||||
|
||||
[More info on this from the WP Codex](https://developer.wordpress.org/themes/advanced-topics/child-themes/#referencing-or-including-other-files)
|
||||
|
||||
## Child theme support
|
||||
|
||||
Although we do offer basic child theme support that can easily be answered, it still falls under theme customization, so please refer to our [support policy](https://woo.com/support-policy/) to see the extent of support we give. We highly advise anybody confused with child themes to use the [WordPress forums](https://wordpress.org/support/forums/) for help.
|
||||
|
||||
## Sample child theme
|
||||
|
||||
Download the sample child theme at the top of this article to get started. Place the child theme in your **wp-content/themes/** folder along with your parent theme.
|
|
@ -1,4 +1,6 @@
|
|||
# WooCommerce Endpoints
|
||||
---
|
||||
post_title: WooCommerce Endpoints
|
||||
---
|
||||
|
||||
**Note:** We are unable to provide support for customizations under our **[Support Policy](https://woo.com/support-policy/)**. If you need to further customize a snippet, or extend its functionality, we highly recommend [**Codeable**](https://codeable.io/?ref=z4Hnp), or a [**Certified WooExpert**](https://woo.com/experts/).
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# High Performance Order Storage (HPOS)
|
||||
---
|
||||
post_title: High Performance Order Storage (HPOS)
|
||||
---
|
||||
|
||||
WooCommerce has traditionally stored store orders and related order information (like refunds) as custom WordPress post types or post meta records. This comes with performance issues.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# How to enable HPOS
|
||||
---
|
||||
post_title: How to enable HPOS
|
||||
---
|
||||
|
||||
From WooCommerce 8.2, released on October 2023, HPOS is enabled by default for new installations. Existing stores can switch to the “High-Performance Order Storage” from “WordPress Posts Storage” by following the below steps.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Translating WooCommerce
|
||||
---
|
||||
post_title: Translating WooCommerce
|
||||
---
|
||||
|
||||
WooCommerce is already translated into several languages and is translation-ready right out of the box. All that’s needed is a translation file for your language.
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
# Payment Gateway API
|
||||
---
|
||||
post_title: Payment gateway API
|
||||
---
|
||||
|
||||
Payment gateways in WooCommerce are class based and can be added through traditional plugins. This guide provides an intro to gateway development.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# WooCommerce payment gateway plugin base
|
||||
---
|
||||
post_title: WooCommerce payment gateway plugin base
|
||||
---
|
||||
|
||||
This code can be used as a base to create your own simple custom payment gateway for WooCommerce. If not used in a custom plugin, you need to 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. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Payment Token API
|
||||
---
|
||||
post_title: Payment token API
|
||||
---
|
||||
|
||||
WooCommerce 2.6 introduced an API for storing and managing payment tokens for gateways. Users can also manage these tokens from their account settings and choose from saved payment tokens on checkout.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Product Editor Development Handbook
|
||||
---
|
||||
post_title: Product Editor Development Handbook
|
||||
---
|
||||
|
||||
> ⚠️ **Notice:** This documentation is currently a **work in progress**. Please be aware that some sections might be incomplete or subject to change. We appreciate your patience and welcome any contributions!
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Block template lifecycle
|
||||
---
|
||||
post_title: Block template lifecycle
|
||||
---
|
||||
|
||||
A block template is a tree structure of blocks that define the product editor's form structure.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Product Editor Extensibility Guidelines
|
||||
---
|
||||
post_title: Product editor extensibility guidelines
|
||||
---
|
||||
|
||||
> ⚠️ **Notice:** These guidelines are currently a **work in progress**. Please be aware that some details might be incomplete or subject to change. We appreciate your patience and welcome any contributions!
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Coding standards for the code snippets within the WooCommerce documentation
|
||||
---
|
||||
post_title: Coding standards for the code snippets within the WooCommerce documentation
|
||||
---
|
||||
|
||||
## Position of hooks
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# WooCommerce core critical flows
|
||||
---
|
||||
post_title: WooCommerce core critical flows
|
||||
---
|
||||
|
||||
We have identified what we consider to be our most critical user flows within WooCommerce Core. These flows will help us focus and prioritize our testing efforts. They will also help us consider the impact of changes and priority of issues.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# CSS/Sass Naming Conventions
|
||||
---
|
||||
post_title: CSS/Sass naming conventions
|
||||
---
|
||||
|
||||
Table of Contents:
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# WooCommerce grammar, punctuation and capitalization guide
|
||||
---
|
||||
post_title: WooCommerce grammar, punctuation and capitalization guide
|
||||
---
|
||||
|
||||
Following grammar, punctuation and style guidelines helps keep our presentation consistent. Users have a better experience if they know what to expect and where to find the information they need.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Naming Conventions
|
||||
---
|
||||
post_title: Naming conventions
|
||||
---
|
||||
|
||||
Table of Contents:
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Performance optimization for WooCommerce stores
|
||||
---
|
||||
post_title: Performance optimization for WooCommerce stores
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
# Quality and Best Practices
|
||||
---
|
||||
category_title: Quality And Best Practices
|
||||
category_slug: quality-and-best-practices
|
||||
post_title: Quality and best practices
|
||||
---
|
||||
|
||||
> ⚠️ **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!
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
# Removing /product/ , /product-category/ , or /shop/ from the URLs
|
||||
---
|
||||
post_title: Removing /product/ , /product-category/ , or /shop/ from the URLs
|
||||
---
|
||||
|
||||
**Note:** This is a **Developer level** doc. If you are unfamiliar with code/templates and resolving potential conflicts, select a [WooExpert or Developer](https://woo.com/customizations/) for assistance. We are unable to provide support for customizations under our [Support Policy](https://woo.com/support-policy/).
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Writing high quality testing instructions
|
||||
---
|
||||
post_title: Writing high quality testing instructions
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
# Reference Code
|
||||
|
||||
> ⚠️ **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!
|
||||
|
||||
Dive deep into code snippets, examples, and templates tailored for WooCommerce. This section will serve as a valuable resource for developers, providing reusable pieces of code that can be integrated into various WooCommerce projects.
|
|
@ -1,4 +1,6 @@
|
|||
# Adding columns to analytics reports and CSV downloads
|
||||
---
|
||||
post_title: Adding columns to analytics reports and CSV downloads
|
||||
---
|
||||
|
||||
Adding columns to analytics reports are a really interesting way to add functionality to WooCommerce. New data can be consumed in the table view of the user interface and in your user's favourite spreadsheet or third party application by generating a CSV.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Extending WC-Admin reports
|
||||
---
|
||||
post_title: Extending WooCommerce Analytics reports
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
# Reporting
|
||||
---
|
||||
category_title: Reporting
|
||||
category_slug: reporting
|
||||
post_title: Reporting
|
||||
---
|
||||
|
||||
> ⚠️ **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!
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Getting started with the REST API
|
||||
---
|
||||
post_title: Getting started with the REST API
|
||||
---
|
||||
|
||||
The REST API is a powerful part of WooCommerce which lets you read and write various parts of WooCommerce data such as orders, products, coupons, customers, and shipping zones.
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
# REST API
|
||||
---
|
||||
category_title: REST API
|
||||
category_slug: rest-api
|
||||
post_title: REST API
|
||||
---
|
||||
|
||||
> ⚠️ **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!
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
# Security
|
||||
---
|
||||
category_title: Security
|
||||
category_slug: security
|
||||
post_title: Security
|
||||
---
|
||||
|
||||
> ⚠️ **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!
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Reporting security issues
|
||||
---
|
||||
post_title: Reporting security issues
|
||||
---
|
||||
|
||||
WooCommerce cares deeply about security and works hard to keep our merchants and their customers safe.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# WooCommerce security best practices
|
||||
---
|
||||
post_title: WooCommerce security best practices
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Shipping Method API
|
||||
---
|
||||
post_title: Shipping method API
|
||||
---
|
||||
|
||||
WooCommerce has a shipping method API which plugins can use to add their own rates. This article will take you through the steps to creating a new shipping method and interacting with the API.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Technical documentation style guide
|
||||
---
|
||||
post_title: Technical documentation style guide
|
||||
---
|
||||
|
||||
This style guide is intended to provide guidelines for creating effective and user-friendly tutorials and how-to guides for WooCommerce technical documentation that will live in repo and be editable and iterative by open source contributors and WooCommerce teams.
|
||||
|
||||
|
@ -62,7 +64,9 @@ Note: While we've outlined specific rules above, all other default linting rules
|
|||
- Use the ATX-style (`#`) for headers.
|
||||
|
||||
```markdown
|
||||
---
|
||||
# This is an H1
|
||||
---
|
||||
## This is an H2
|
||||
```
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Theme Design and Development at Woo
|
||||
---
|
||||
post_title: Theme Design and Development at Woo
|
||||
---
|
||||
|
||||
## Classic Themes
|
||||
|
||||
|
|
|
@ -0,0 +1,223 @@
|
|||
---
|
||||
post_title: Classic Theme Developer Handbook
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
**Note:** this document is geared toward the development of classic themes. For the recommended modern approach, visit [Develop Your First Low-Code Block Theme](https://learn.wordpress.org/course/develop-your-first-low-code-block-theme/) to learn about block theme development, and explore the [Create Block Theme plugin](https://wordpress.org/plugins/create-block-theme/) tool when you're ready to create a new theme.
|
||||
|
||||
---
|
||||
|
||||
WooCommerce looks great with all WordPress themes as of version 3.3, even if they are not WooCommerce-specific themes and do not formally declare support. Templates render inside the content, and this keeps everything looking natural on your site.
|
||||
|
||||
Non-WooCommerce themes, by default, also include:
|
||||
|
||||
- Zoom feature enabled – ability to zoom in/out on a product image
|
||||
- Lightbox feature enabled – product gallery images pop up to examine closer
|
||||
- Comments enabled, not Reviews – visitors/buyers can leave comments as opposed to product ratings or reviews
|
||||
|
||||
If you want more control over the layout of WooCommerce elements or full reviews support your theme will need to integrate with WooCommerce. There are a few different ways you can do this, and they are outlined below.
|
||||
|
||||
## Theme Integration
|
||||
|
||||
There are three possible ways to integrate WooCommerce with a theme. If you are using WooCommerce 3.2 or below (**strongly discouraged**) you will need to use one of these methods to ensure WooCommerce shop and product pages are rendered correctly in your theme. If you are using a version of WooCommerce 3.3 or above you only need to do a theme integration if the automatic one doesn’t meet your needs.
|
||||
|
||||
### Using `woocommerce_content()`
|
||||
|
||||
This solution allows you to create a new template page within your theme that is used for **all WooCommerce taxonomy and post type displays**. While an easy catch-all solution, it does have a drawback in that this template is used for **all WooCommerce taxonomies** (product categories, etc.) and **post types** (product archives, single product pages). Developers are encouraged to use the hooks instead (see below).
|
||||
|
||||
To set up this template page:
|
||||
|
||||
1. **Duplicate page.php:** Duplicate your theme’s `page.php` file, and name it `woocommerce.php`. This path to the file should follow this pattern: `wp-content/themes/YOURTHEME/woocommerce.php`.
|
||||
2. **Edit your page (woocommerce.php)**: Open up your newly created `woocommerce.php` in a text editor.
|
||||
3. **Replace the loop:** Next you need to find the loop (see [The_Loop](https://codex.wordpress.org/The_Loop)). The loop usually starts with code like this:
|
||||
|
||||
```php
|
||||
<?php if ( have_posts() ) :
|
||||
```
|
||||
|
||||
It usually ends with this:
|
||||
|
||||
```php
|
||||
<?php endif; ?>
|
||||
```
|
||||
|
||||
This varies between themes. Once you have found it, **delete it**. In its place, put:
|
||||
|
||||
```php
|
||||
<?php woocommerce_content(); ?>
|
||||
```
|
||||
|
||||
This will make it use **WooCommerce’s loop instead**. Save the file. You’re done.
|
||||
|
||||
**Note:** When creating `woocommerce.php` in your theme’s folder, you will not be able to override the `woocommerce/archive-product.php` custom template as `woocommerce.php` has priority over `archive-product.php`. This is intended to prevent display issues.
|
||||
|
||||
### Using hooks
|
||||
|
||||
The hook method is more involved, but it is also more flexible. This is similar to the method we use when creating themes. It’s also the method we use to integrate nicely with WordPress default themes.
|
||||
|
||||
Insert a few lines in your theme’s `functions.php` file.
|
||||
|
||||
First unhook the WooCommerce wrappers:
|
||||
|
||||
```php
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
|
||||
```
|
||||
|
||||
Then hook in your own functions to display the wrappers your theme requires:
|
||||
|
||||
```php
|
||||
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
|
||||
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);
|
||||
|
||||
function my_theme_wrapper_start() {
|
||||
echo '<section id="main">';
|
||||
}
|
||||
|
||||
function my_theme_wrapper_end() {
|
||||
echo '</section>';
|
||||
}
|
||||
```
|
||||
|
||||
Make sure that the markup matches that of your theme. If you’re unsure of which classes or IDs to use, take a look at your theme’s `page.php` for guidance.
|
||||
|
||||
**Whenever possible use the hooks to add or remove content. This method is more robust than overriding the templates.** If you have overridden a template, you have to update the template any time the file changes. If you are using the hooks, you will only have to update if the hooks change, which happens much less frequently.
|
||||
|
||||
### Using template overrides
|
||||
|
||||
For information about overriding the WooCommerce templates with your own custom templates read the **Template Structure** section below. This method requires more maintenance than the hook-based method, as templates will need to be kept up-to-date with the WooCommerce core templates.
|
||||
|
||||
## Declaring WooCommerce Support
|
||||
|
||||
If you are using custom WooCommerce template overrides in your theme you need to declare WooCommerce support using the `add_theme_support` function. WooCommerce template overrides are only enabled on themes that declare WooCommerce support. If you do not declare WooCommerce support in your theme, WooCommerce will assume the theme is not designed for WooCommerce compatibility and will use shortcode-based unsupported theme rendering to display the shop.
|
||||
|
||||
Declaring WooCommerce support is straightforward and involves adding one function in your theme’s `functions.php` file.
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```php
|
||||
function mytheme_add_woocommerce_support() {
|
||||
add_theme_support( 'woocommerce' );
|
||||
}
|
||||
|
||||
add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );
|
||||
```
|
||||
|
||||
Make sure you are using the `after_setup_theme` hook and not the `init` hook. Read more about this in [the documentation for `add_theme_support`](https://developer.wordpress.org/reference/functions/add_theme_support/).
|
||||
|
||||
### Usage with Settings
|
||||
|
||||
```php
|
||||
function mytheme_add_woocommerce_support() {
|
||||
add_theme_support( 'woocommerce', array(
|
||||
'thumbnail_image_width' => 150,
|
||||
'single_image_width' => 300,
|
||||
|
||||
'product_grid' => array(
|
||||
'default_rows' => 3,
|
||||
'min_rows' => 2,
|
||||
'max_rows' => 8,
|
||||
'default_columns' => 4,
|
||||
'min_columns' => 2,
|
||||
'max_columns' => 5,
|
||||
),
|
||||
) );
|
||||
}
|
||||
|
||||
add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );
|
||||
```
|
||||
|
||||
These are optional theme settings that you can set when declaring WooCommerce support.
|
||||
|
||||
`thumbnail_image_width` and `single_image_width` will set the image sizes for the shop. If these are not declared when adding theme support, the user can set image sizes in the Customizer under the **WooCommerce > Product Images** section.
|
||||
|
||||
The `product_grid` settings let theme developers set default, minimum, and maximum column and row settings for the Shop. Users can set the rows and columns in the Customizer under the **WooCommerce > Product Catalog** section.
|
||||
|
||||
### Product gallery features (zoom, swipe, lightbox)
|
||||
|
||||
The product gallery introduced in 3.0.0 ([read here for more information](https://developer.woo.com/2016/10/19/new-product-gallery-merged-in-to-core-for-2-7/)) uses Flexslider, Photoswipe, and the jQuery Zoom plugin to offer swiping, lightboxes, and other neat features.
|
||||
|
||||
In versions `3.0`, `3.1`, and `3.2`, the new gallery is off by default and needs to be enabled using a snippet (below) or by using a compatible theme. This is because it’s common for themes to disable the WooCommerce gallery and replace it with their own scripts.
|
||||
|
||||
In versions `3.3+`, the gallery is off by default for WooCommerce compatible themes unless they declare support for it (below). 3rd party themes with no WooCommerce support will have the gallery enabled by default.
|
||||
|
||||
To enable the gallery in your theme, you can declare support like this:
|
||||
|
||||
```php
|
||||
add_theme_support( 'wc-product-gallery-zoom' );
|
||||
add_theme_support( 'wc-product-gallery-lightbox' );
|
||||
add_theme_support( 'wc-product-gallery-slider' );
|
||||
```
|
||||
|
||||
You do not have to support all three parts of the gallery; you can pick and choose features. If a feature is not enabled, the scripts will not be loaded and the gallery code will not execute on product pages.
|
||||
|
||||
If gallery features are enabled (e.g., you have a theme that enabled them, or you are running a theme that is not compatible with WooCommerce), you can disable them with `remove_theme_support`:
|
||||
|
||||
```php
|
||||
remove_theme_support( 'wc-product-gallery-zoom' );
|
||||
remove_theme_support( 'wc-product-gallery-lightbox' );
|
||||
remove_theme_support( 'wc-product-gallery-slider' );
|
||||
```
|
||||
|
||||
You can disable any parts; you do not need to disable all features.
|
||||
|
||||
## Template Structure
|
||||
|
||||
WooCommerce template files contain the **markup** and **template structure** for **the frontend and the HTML emails** of your store. If some structural change in HTML is necessary, you should override a template.
|
||||
|
||||
When you open these files, you will notice they all contain **hooks** that allow you to add or move content without needing to edit the template files themselves. This method protects against upgrade issues, as the template files can be left completely untouched.
|
||||
|
||||
Template files can be found within the `**/woocommerce/templates/**` directory.
|
||||
|
||||
### How to Edit Files
|
||||
|
||||
Edit files in an **upgrade-safe way** using *overrides*. Copy them into a directory within your theme named `/woocommerce`, keeping the same file structure but removing the `/templates/` subdirectory.
|
||||
|
||||
Example: To override the admin order notification, copy `wp-content/plugins/woocommerce/templates/emails/admin-new-order.php` to `wp-content/themes/yourtheme/woocommerce/emails/admin-new-order.php`.
|
||||
|
||||
The copied file will now override the WooCommerce default template file.
|
||||
|
||||
**Warning:** Do not delete any WooCommerce hooks when overriding a template. This would prevent plugins hooking in to add content.
|
||||
|
||||
**Warning:** Do not edit these files within the core plugin itselfe as they are overwritten during the upgrade process and any customizations will be lost.
|
||||
|
||||
## CSS Structure
|
||||
|
||||
Inside the `assets/css/` directory, you will find the stylesheets responsible for the default WooCommerce layout styles.
|
||||
|
||||
Files to look for are `woocommerce.scss` and `woocommerce.css`.
|
||||
|
||||
- `woocommerce.css` is the minified stylesheet – it’s the CSS without any of the spaces, indents, etc. This makes the file very fast to load. This file is referenced by the plugin and declares all WooCommerce styles.
|
||||
- `woocommerce.scss` is not directly used by the plugin, but by the team developing WooCommerce. We use [SASS](http://sass-lang.com/) in this file to generate the CSS in the first file.
|
||||
|
||||
The CSS is written to make the default layout compatible with as many themes as possible by using percentage-based widths for all layout styles. It is, however, likely that you’ll want to make your own adjustments.
|
||||
|
||||
### Modifications
|
||||
|
||||
To avoid upgrade issues, we advise not editing these files but rather using them as a point of reference.
|
||||
|
||||
If you just want to make changes, we recommend adding some overriding styles to your theme stylesheet. For example, add the following to your theme stylesheet to make WooCommerce buttons black instead of the default color:
|
||||
|
||||
```css
|
||||
a.button,
|
||||
button.button,
|
||||
input.button,
|
||||
#review_form #submit {
|
||||
background:black;
|
||||
}
|
||||
```
|
||||
|
||||
WooCommerce also outputs the theme name (plus other useful information, such as which type of page is being viewed) as a class on the body tag, which can be useful for overriding styles.
|
||||
|
||||
### Disabling WooCommerce styles
|
||||
|
||||
If you plan to make major changes, or create a theme from scratch, then you may prefer your theme not reference the WooCommerce stylesheet at all. You can tell WooCommerce to not use the default `woocommerce.css` by adding the following code to your theme’s `functions.php` file:
|
||||
|
||||
```php
|
||||
add_filter( 'woocommerce_enqueue_styles', '__return_false' );
|
||||
```
|
||||
|
||||
With this definition in place, your theme will no longer use the WooCommerce stylesheet and give you a blank canvas upon which you can build your own desired layout and styles.
|
||||
|
||||
Styling a WooCommerce theme from scratch for the first time is no easy task. There are many different pages and elements that need to be styled, and if you’re new to WooCommerce, you are probably not familiar with many of them. A non-exhaustive list of WooCommerce elements to style can be found [here](https://developer.files.wordpress.com/2017/12/woocommerce-theme-testing-checklist.pdf).
|
|
@ -0,0 +1,98 @@
|
|||
---
|
||||
post_title: Conditional tags
|
||||
---
|
||||
|
||||
**Note:** This is a **Developer level** doc. If you are unfamiliar with code/tags and resolving potential conflicts, select a [WooExpert or Developer](https://woo.com/customizations/) for assistance. We are unable to provide support for customizations under our [Support Policy](https://woo.com/support-policy/).
|
||||
|
||||
## What are “conditional tags”?
|
||||
|
||||
The conditional tags of WooCommerce and WordPress can be used in your template files to change what content is displayed based on what *conditions* the page matches. For example, you may want to display a snippet of text above the shop page. With the `is_shop()` conditional tag, you can.
|
||||
|
||||
Because WooCommerce uses custom post types, you can also use many of WordPress’ conditional tags. See [codex.wordpress.org/Conditional_Tags](https://codex.wordpress.org/Conditional_Tags) for a list of the tags included with WordPress.
|
||||
|
||||
**Note**: You can only use conditional query tags after the `posts_selection` [action hook](https://codex.wordpress.org/Plugin_API/Action_Reference#Actions_Run_During_a_Typical_Request) in WordPress (the `wp` action hook is the first one through which you can use these conditionals). For themes, this means the conditional tag will never work properly if you are using it in the body of functions.php.
|
||||
|
||||
## Available conditional tags
|
||||
|
||||
All conditional tags test whether a condition is met, and then return either `TRUE` or `FALSE`. **Conditions under which tags output `TRUE` are listed below the conditional tags**.
|
||||
|
||||
The list below holds the main conditional tags. To see all conditional tags, visit the [WooCommerce API Docs](https://woo.com/wc-apidocs/).
|
||||
|
||||
### WooCommerce page
|
||||
|
||||
- `is_woocommerce()`
|
||||
Returns true if on a page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and thus are not included).
|
||||
|
||||
### Main shop page
|
||||
|
||||
- `is_shop()`
|
||||
Returns true when on the product archive page (shop).
|
||||
|
||||
### Product category page
|
||||
|
||||
- `is_product_category()`
|
||||
Returns true when viewing a product category archive.
|
||||
- `is_product_category( 'shirts' )`
|
||||
When the product category page for the ‘shirts’ category is being displayed.
|
||||
- `is_product_category( array( 'shirts', 'games' ) )`
|
||||
When the product category page for the ‘shirts’ or ‘games’ category is being displayed.
|
||||
|
||||
### Product tag page
|
||||
|
||||
- `is_product_tag()`
|
||||
Returns true when viewing a product tag archive
|
||||
- `is_product_tag( 'shirts' )`
|
||||
When the product tag page for the ‘shirts’ tag is being displayed.
|
||||
- `is_product_tag( array( 'shirts', 'games' ) )`
|
||||
When the product tag page for the ‘shirts’ or ‘games’ tags is being displayed.
|
||||
|
||||
### Single product page
|
||||
|
||||
- `is_product()`
|
||||
Returns true on a single product page. Wrapper for is_singular.
|
||||
|
||||
### Cart page
|
||||
|
||||
- `is_cart()`
|
||||
Returns true on the cart page.
|
||||
|
||||
### Checkout page
|
||||
|
||||
- `is_checkout()`
|
||||
Returns true on the checkout page.
|
||||
|
||||
### Customer account pages
|
||||
|
||||
- `is_account_page()`
|
||||
Returns true on the customer’s account pages.
|
||||
|
||||
### Endpoint
|
||||
|
||||
- `is_wc_endpoint_url()`
|
||||
Returns true when viewing a WooCommerce endpoint
|
||||
- `is_wc_endpoint_url( 'order-pay' )`
|
||||
When the endpoint page for order pay is being displayed.
|
||||
- And so on for other endpoints...
|
||||
|
||||
### Ajax request
|
||||
|
||||
- `is_ajax()`
|
||||
Returns true when the page is loaded via ajax.
|
||||
|
||||
## Working example
|
||||
|
||||
The example illustrates how you would display different content for different categories.
|
||||
|
||||
```php
|
||||
if ( is_product_category() ) {
|
||||
|
||||
if ( is_product_category( 'shirts' ) ) {
|
||||
echo 'Hi! Take a look at our sweet t-shirts below.';
|
||||
} elseif ( is_product_category( 'games' ) ) {
|
||||
echo 'Hi! Hungry for some gaming?';
|
||||
} else {
|
||||
echo 'Hi! Check out our products below.';
|
||||
}
|
||||
|
||||
}
|
||||
```
|
|
@ -1,4 +1,6 @@
|
|||
# Fixing Outdated WooCommerce Templates
|
||||
---
|
||||
post_title: Fixing outdated WooCommerce templates
|
||||
---
|
||||
|
||||
## Template Updates and Changes
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Theme Design and User Experience Guidelines
|
||||
---
|
||||
post_title: Theme design and user experience guidelines
|
||||
---
|
||||
|
||||
This guide covers general guidelines and best practices to follow in order to ensure your theme experience aligns with ecommerce industry standards and WooCommerce for providing a great online shopping experience, maximizing sales, ensuring ease of use, seamless integration, and strong UX adoption.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Adding a custom field to simple and variable products
|
||||
---
|
||||
post_title: Adding a custom field to simple and variable products
|
||||
---
|
||||
|
||||
In this tutorial you will learn how to create a custom field for a product and show it in your store. Together we will set up the skeleton plugin, and learn about WP naming conventions and WooCommerce hooks. In the end, you will have a functioning plugin for adding a custom field.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Adding actions and filters
|
||||
---
|
||||
post_title: Adding actions and filters
|
||||
---
|
||||
|
||||
Like many WordPress plugins, WooCommerce provides a range of actions and filters through which developers can extend and modify the platform.
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
# Tutorials
|
||||
---
|
||||
category_title: Tutorials
|
||||
category_slug: tutorials
|
||||
post_title: Tutorials
|
||||
---
|
||||
|
||||
> ⚠️ **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!
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# User Experience Guidelines: Accessibility
|
||||
---
|
||||
post_title: User experience guidelines - accessibility
|
||||
---
|
||||
|
||||
## Accessibility
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# User Experience Guidelines: Best Practices
|
||||
---
|
||||
post_title: User experience guidelines - best practices
|
||||
---
|
||||
|
||||
## Best practices
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# User Experience Guidelines: Colors
|
||||
---
|
||||
post_title: User experience guidelines - colors
|
||||
---
|
||||
|
||||
## Colors
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# User Experience Guidelines: Notices
|
||||
---
|
||||
post_title: User experience guidelines - notices
|
||||
---
|
||||
|
||||
## Notices
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# User Experience Guidelines: Onboarding
|
||||
---
|
||||
post_title: User experience guidelines - onboarding
|
||||
---
|
||||
|
||||
## Onboarding
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# User Experience Guidelines: Task list and Inbox
|
||||
---
|
||||
post_title: User experience guidelines - task list and inbox
|
||||
---
|
||||
|
||||
## Task List & Inbox
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# User Experience Guidelines
|
||||
---
|
||||
post_title: User experience guidelines
|
||||
---
|
||||
|
||||
This guide covers general guidelines, and best practices to follow in order to ensure your product experience aligns with WooCommerce for ease of use, seamless integration, and strong adoption.
|
||||
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
---
|
||||
post_title: Configuring caching plugins for WooCommerce
|
||||
---
|
||||
|
||||
## Excluding Pages from the Cache
|
||||
|
||||
Oftentimes if using caching plugins they’ll already exclude these pages. Otherwise make sure you exclude the following pages from the cache through your caching systems respective settings.
|
||||
|
||||
- Cart
|
||||
- My Account
|
||||
- Checkout
|
||||
|
||||
These pages need to stay dynamic since they display information specific to the current customer and their cart.
|
||||
|
||||
## Excluding WooCommerce Session from the Cache
|
||||
|
||||
If the caching system you’re using offers database caching, it might be helpful to exclude `_wc_session_` from being cached. This will be dependent on the plugin or host caching so refer to the specific instructions or docs for that system.
|
||||
|
||||
## Excluding WooCommerce Cookies from the Cache
|
||||
|
||||
Cookies in WooCommerce help track the products in your customers cart, can keep their cart in the database if they leave the site, and powers the recently viewed widget. Below is a list of the cookies WooCommerce uses for this, which you can exclude from caching.
|
||||
|
||||
| COOKIE NAME | DURATION | PURPOSE |
|
||||
| --- | --- | --- |
|
||||
| woocommerce_cart_hash | session | Helps WooCommerce determine when cart contents/data changes. |
|
||||
| woocommerce_items_in_cart | session | Helps WooCommerce determine when cart contents/data changes. |
|
||||
| wp_woocommerce_session_ | 2 days | Contains a unique code for each customer so that it knows where to find the cart data in the database for each customer. |
|
||||
| woocommerce_recently_viewed | session | Powers the Recent Viewed Products widget. |
|
||||
| store_notice[notice id] | session | Allows customers to dismiss the Store Notice. |
|
||||
|
||||
We’re unable to cover all options, but we have added some tips for the popular caching plugins. For more specific support, please reach out to the support team responsible for your caching integration.
|
||||
|
||||
### W3 Total Cache Minify Settings
|
||||
|
||||
Ensure you add ‘mfunc’ to the ‘Ignored comment stems’ option in the Minify settings.
|
||||
|
||||
### WP-Rocket
|
||||
|
||||
WooCommerce is fully compatible with WP-Rocket. Please ensure that the following pages (Cart, Checkout, My Account) are not to be cached in the plugin’s settings.
|
||||
|
||||
We recommend avoiding JavaScript file minification.
|
||||
|
||||
### WP Super Cache
|
||||
|
||||
WooCommerce is natively compatible with WP Super Cache. WooCommerce sends information to WP Super Cache so that it doesn’t cache the Cart, Checkout, or My Account pages by default.
|
||||
|
||||
### Varnish
|
||||
|
||||
```varnish
|
||||
if (req.url ~ "^/(cart|my-account|checkout|addons)") {
|
||||
return (pass);
|
||||
}
|
||||
if ( req.url ~ "\\?add-to-cart=" ) {
|
||||
return (pass);
|
||||
}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Why is my Varnish configuration not working in WooCommerce?
|
||||
|
||||
Check out the following WordPress.org Support forum post on[ how cookies may be affecting your varnish coding](https://wordpress.org/support/topic/varnish-configuration-not-working-in-woocommerce).
|
||||
|
||||
```text
|
||||
Add this to vcl_recv above "if (req.http.cookie) {":
|
||||
|
||||
# Unset Cookies except for WordPress admin and WooCommerce pages
|
||||
if (!(req.url ~ "(wp-login|wp-admin|cart|my-account/*|wc-api*|checkout|addons|logout|lost-password|product/*)")) {
|
||||
unset req.http.cookie;
|
||||
}
|
||||
# Pass through the WooCommerce dynamic pages
|
||||
if (req.url ~ "^/(cart|my-account/*|checkout|wc-api/*|addons|logout|lost-password|product/*)") {
|
||||
return (pass);
|
||||
}
|
||||
# Pass through the WooCommerce add to cart
|
||||
if (req.url ~ "\?add-to-cart=" ) {
|
||||
return (pass);
|
||||
}
|
||||
# Pass through the WooCommerce API
|
||||
if (req.url ~ "\?wc-api=" ) {
|
||||
return (pass);
|
||||
}
|
||||
# Block access to php admin pages via website
|
||||
if (req.url ~ "^/phpmyadmin/.*$" || req.url ~ "^/phppgadmin/.*$" || req.url ~ "^/server-status.*$") {
|
||||
error 403 "For security reasons, this URL is only accesible using localhost (127.0.0.1) as the hostname";
|
||||
}
|
||||
|
||||
Add this to vcl_fetch:
|
||||
|
||||
# Unset Cookies except for WordPress admin and WooCommerce pages
|
||||
if ( (!(req.url ~ "(wp-(login|admin)|login|cart|my-account/*|wc-api*|checkout|addons|logout|lost-password|product/*)")) || (req.request == "GET") ) {
|
||||
unset beresp.http.set-cookie;
|
||||
}
|
||||
```
|
||||
|
||||
### Why is my Password Reset stuck in a loop?
|
||||
|
||||
This is due to the My Account page being cached, Some hosts with server-side caching don’t prevent my-account.php from being cached.
|
||||
|
||||
If you’re unable to reset your password and keep being returned to the login screen, please speak to your host to make sure this page is being excluded from their caching.
|
|
@ -1,4 +1,6 @@
|
|||
# Logging in WooCommerce
|
||||
---
|
||||
post_title: Logging in WooCommerce
|
||||
---
|
||||
|
||||
WooCommerce has its own robust system for logging, which can be used for debugging during development, catching errors on production, or even sending notifications when specific events occur. By default, WooCommerce uses this logger to record errors, warnings, and other notices that may be useful for troubleshooting problems with a store. Many extensions for WooCommerce also make use of the logger for similar purposes.
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# WC CLI: Commands
|
||||
---
|
||||
post_title: WC CLI - commands
|
||||
---
|
||||
|
||||
## wc shop_coupon
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# WC CLI: Overview
|
||||
---
|
||||
post_title: WC CLI - overview
|
||||
---
|
||||
|
||||
WooCommerce CLI (WC-CLI) offers the ability to manage WooCommerce (WC) via the command-line, using WP CLI. The documentation here covers the version of WC CLI that started shipping in WC 3.0.0 and later.
|
||||
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
# Changelog
|
||||
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.0.0](https://www.npmjs.com/package/@woocommerce/admin-layout/v/1.0.0) - 2023-11-28
|
||||
|
||||
- Patch - Update dependencies.
|
||||
- Minor - Adding LayoutContext component and hook. [#37720]
|
||||
- Minor - Adding support for modifying fill name to WooHeaderItem. [#37255]
|
||||
- Minor - Create @woocommerce/admin-layout package to house header, footer, and similar components and utilities. [#37094]
|
||||
- Patch - Make eslint emit JSON report for annotating PRs. [#39704]
|
||||
- Patch - Update webpack config to use @woocommerce/internal-style-build's parser config [#37195]
|
||||
- Minor - Upgrade TypeScript to 5.1.6 [#39531]
|
||||
|
||||
[See legacy changelogs for previous versions](https://github.com/woocommerce/woocommerce/blob/68581955106947918d2b17607a01bdfdf22288a9/packages/js/admin-layout/CHANGELOG.md).
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue