A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
Go to file
Néstor Soriano 3f155c9a63
[COT] Add the orders cache (#34396)
* Reverse the order of "$id" and "$object" in ObjectCache::set

* Add the ObjectCache::update_if_cached method

* Modify ObjectCache:set to validate object before invoking get_id

* Add a temporary TransientsEngine class.

This is temporary! Must be removed before merging to trunk.

* Add the OrderCache class.

This class uses a TransientsEngine instance as the caching engine.
This is temporary and must be undone (get_cache_engine_instance method
must be removed) before merging to trunk!

* Use the new OrdersCache class

- When an order is retrieved, cache it
- When an order is saved, update it if it was cached already
- When an order is trashed or deleted, remove it from cache
- When the authoritative table for orders changes, flush the cache

* Remove the hardcoded usage of TransientEngine in OrderCache

It will make things easier later before merging. The transients engine
can still be used via the wc_object_cache_get_engine hook.

* Add changelog file

* Fix failing unit test

The test was failing because the order is cached by reference when
being saved in the test, and then when being deleted by the REST API
code it gets its id set to 0.

* Add a setting to enable/disable the orders cache

Also added a mechanism to temporarily disable the orders cache while
syncrhonization is in progress.

* Adjustments in the mechanism to temporarily disable the orders cache usage

* OrderCacheController: backup enable option is now stored in memory.

* Convert conditions to Yoda :-(

* Add missing $

* Use the new features engine to declare the cache as an experimental feature

Also decouple the orders cache mechanism from the COT feature,
it can be now used indepently of the COT feature and independently
of whether the new orders table is in use or not.

* Removed unused import and transient class.

Co-authored-by: Vedanshu Jain <vedanshu.jain.2012@gmail.com>
2022-10-07 12:46:24 +05:30
.github Implement `maxFailures` and warning messages (#33977) 2022-10-05 10:44:20 -07:00
.husky Remove the pre-commit husky hook (#34916) 2022-10-03 11:51:12 +13:00
bin Do a checkout of compared branches to ensure prepush checks work (#34706) 2022-09-19 12:58:52 +12:00
packages Add Tiktok to OBW grow list (#34953) 2022-10-07 13:50:35 +08:00
plugins [COT] Add the orders cache (#34396) 2022-10-07 12:46:24 +05:30
tools Storybook: Add react and react-dom dependencies (#34950) 2022-10-07 15:18:10 +13:00
.codecov.yml chore(ci): add informational Codecov status checks (#32675) 2022-04-26 10:20:59 +12:00
.editorconfig JS formatting files 2021-10-19 10:35:46 +13:00
.eslintignore JS formatting files 2021-10-19 10:35:46 +13:00
.eslintrc.js Designate root level eslint config 2021-12-13 08:13:40 -08:00
.gitignore Add/a2p create customers crud api core tests (#34945) 2022-10-05 12:45:26 -06:00
.npmrc Upgrade to pnpm 7 (#34661) 2022-09-16 09:21:42 +12:00
.nvmrc Update package and node version 2021-12-15 07:08:37 -08:00
.prettierrc.js JS formatting files 2021-10-19 10:35:46 +13:00
.stylelintrc Deprecate stylelint-config-wordpress with current package 2021-12-14 09:14:54 -08:00
.syncpackrc Update plugins installer component to TS, Fix TS bugs and Syncpack TypeScript (#34787) 2022-09-30 10:59:07 +13:00
CODE_OF_CONDUCT.md Fixed a typo 2017-06-19 16:22:40 -03:00
DEVELOPMENT.md Update PNPM commands in documentation post PNPM 7 update (#34853) 2022-09-27 13:55:31 -07:00
README.md Restore 'Contributing to WooCommerce' guidance (#34380) 2022-08-18 10:41:17 -07:00
SECURITY.md Removed the reference to WP mobile apps. 2020-10-02 11:51:35 +02:00
changelog.txt Add changelog and bump version (#34838) 2022-09-26 07:02:12 -07:00
package.json Update plugins installer component to TS, Fix TS bugs and Syncpack TypeScript (#34787) 2022-09-30 10:59:07 +13:00
phpcs.xml Make Yoda conditions mandatory again (#34335) 2022-08-29 11:55:23 +02:00
pnpm-lock.yaml Storybook: Add react and react-dom dependencies (#34950) 2022-10-07 15:18:10 +13:00
pnpm-workspace.yaml Storybook: Fix after update to PNPM 7 broke build (#34724) 2022-09-20 12:39:31 +12:00
renovate.json Converted Spaces To Tabs In JSON 2022-05-10 13:31:01 -07:00
tsconfig.base.json Removed `@woocommerce/notices` Internal Prefix (#33283) 2022-06-03 16:05:26 -07:00
turbo.json Optimize Workflow Caching (#34607) 2022-09-13 13:55:03 +12:00

README.md

WooCommerce

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.

We recommend all developers to follow the WooCommerce development blog to stay up to date about everything happening in the project. You can also follow @DevelopWC on Twitter for the latest development updates.

Getting Started

To get up and running within the WooCommerce Monorepo, you will need to make sure that you have installed all of the prerequisites.

Prerequisites

  • NVM: 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 which helps ensure you are using the correct version of Node.
  • PNPM: Our repository utilizes PNPM to manage project dependencies and run various scripts involved in building and testing projects.
  • PHP 7.2+: WooCommerce Core currently features a minimum PHP version of 7.2. It is also needed to run Composer and various project build scripts.
  • Composer: 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.

# Ensure that you're using the correct version of Node
nvm use
# Install the PHP and Composer dependencies for all of the plugins, packages, and tools
pnpm install
# Build all of the plugins, packages, and tools in the monorepo
pnpm run build

At this point you are now ready to begin developing and testing. All of the build outputs are cached running pnpm run build again will only build the plugins, packages, and tools that have changed since the last time you ran the command.

Check out our development guide if you would like a more comprehensive look at working in our repository.

Repository Structure

  • Plugins: Our repository contains plugins that relate to or otherwise aid in the development of WooCommerce.
    • WooCommerce Core: The core WooCommerce plugin is available in the plugins directory.
  • Packages: Contained within the packages directory are all of the PHP and JavaScript provided for the community. Some of these are internal dependencies and are marked with an internal- prefix.
  • 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.

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:

Support requests in issues on this repository will be closed on sight.

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 for more information on how you can do this.